Filippo Giunchedi has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/327282 )

Change subject: prometheus: use key/value for gdnsd rcodes
......................................................................


prometheus: use key/value for gdnsd rcodes

Bug: T147426
Change-Id: Ibe55d5a40359b43c253cccfac4cb89bbd51ee6fd
---
M modules/prometheus/files/usr/local/bin/prometheus-gdnsd-stats
1 file changed, 7 insertions(+), 7 deletions(-)

Approvals:
  jenkins-bot: Verified
  Filippo Giunchedi: Looks good to me, approved



diff --git a/modules/prometheus/files/usr/local/bin/prometheus-gdnsd-stats 
b/modules/prometheus/files/usr/local/bin/prometheus-gdnsd-stats
index ad08d43..e94f220 100755
--- a/modules/prometheus/files/usr/local/bin/prometheus-gdnsd-stats
+++ b/modules/prometheus/files/usr/local/bin/prometheus-gdnsd-stats
@@ -26,17 +26,14 @@
 
 
 # TODO(filippo) collect 'services' metrics
-# TODO(filippo) use rcode as key=value instead?
 def collect_gdnsd_stats(stats, registry):
     dns_stats = {}
     udp_stats = {}
     tcp_stats = {}
 
-    for rcode in ('noerror', 'refused', 'nxdomain', 'notimp',
-                  'badvers', 'formerr', 'dropped'):
-        dns_stats[rcode] = Gauge(
-            'rcode_{}'.format(rcode), 'RCODE {} sent'.format(rcode),
-            namespace='gdnsd', registry=registry)
+    dns_stats['requests'] = Gauge(
+        'request', 'Requests processed', ['status'],
+        namespace='gdnsd', registry=registry)
     dns_stats['edns'] = Gauge(
         'request_edns', 'EDNS requests', namespace='gdnsd', registry=registry)
     dns_stats['edns_client_subnet'] = Gauge(
@@ -50,7 +47,10 @@
 
     try:
         for name, value in stats['stats'].items():
-            if name in dns_stats:
+            if name in ('noerror', 'refused', 'nxdomain', 'notimp',
+                        'badvers', 'formerr', 'dropped'):
+                dns_stats['requests'].labels(status=name).set(value)
+            elif name in dns_stats:
                 dns_stats[name].set(value)
         for name, value in stats['udp'].items():
             udp_stats[name] = Gauge(

-- 
To view, visit https://gerrit.wikimedia.org/r/327282
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe55d5a40359b43c253cccfac4cb89bbd51ee6fd
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Volans <rcocci...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to