[MediaWiki-commits] [Gerrit] operations/puppet[production]: prometheus: use key/value for gdnsd rcodes

2017-01-03 Thread Filippo Giunchedi (Code Review)
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 
Gerrit-Reviewer: BBlack 
Gerrit-Reviewer: Filippo Giunchedi 
Gerrit-Reviewer: Volans 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: prometheus: use key/value for gdnsd rcodes

2016-12-14 Thread Filippo Giunchedi (Code Review)
Filippo Giunchedi has uploaded a new change for review. ( 
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(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/82/327282/1

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: newchange
Gerrit-Change-Id: Ibe55d5a40359b43c253cccfac4cb89bbd51ee6fd
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi 

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