[MediaWiki-commits] [Gerrit] operations...pybal[master]: Add monitoring specific metric to IdleConnection

2017-08-10 Thread Ema (Code Review)
Ema has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/371117 )

Change subject: Add monitoring specific metric to IdleConnection
..


Add monitoring specific metric to IdleConnection

pybal_monitor_idleconnection_connections_failed_total counts connections
failing to establish.
pybal_monitor_idleconnection_connections_lost_total counts connections
lost for unclean reasons.

Bug: T171710
Change-Id: I9acbcd2c859cc9213e40b7f7019a85be49ca72f8
---
M pybal/monitors/idleconnection.py
1 file changed, 31 insertions(+), 0 deletions(-)

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



diff --git a/pybal/monitors/idleconnection.py b/pybal/monitors/idleconnection.py
index 16bde75..04f6dc3 100644
--- a/pybal/monitors/idleconnection.py
+++ b/pybal/monitors/idleconnection.py
@@ -6,6 +6,7 @@
 """
 
 from pybal import monitor, util
+from pybal.metrics import Counter
 
 from twisted.internet import reactor, protocol
 import logging
@@ -31,6 +32,26 @@
 KEEPALIVE_INTERVAL = 30
 
 __name__ = 'IdleConnection'
+
+metric_labelnames = ('service', 'host', 'monitor')
+metric_keywords = {
+'namespace': 'pybal',
+'subsystem': 'monitor_' + __name__.lower()
+}
+
+idleconnection_metrics = {
+'connections_failed_total': Counter(
+'connections_failed_total',
+'Connections failed to establish',
+labelnames=metric_labelnames + ('reason',),
+**metric_keywords),
+'connections_lost_total': Counter(
+'connections_lost_total',
+'Connections lost uncleanly',
+labelnames=metric_labelnames + ('reason',),
+**metric_keywords)
+}
+
 
 def __init__(self, coordinator, server, configuration):
 """Constructor"""
@@ -76,6 +97,11 @@
 
 self.report("%s failed." % self._report_prefix(), level=logging.WARN)
 
+self.idleconnection_metrics['connections_failed_total'].labels(
+reason=reason.type.__name__,
+**self.metric_labels
+).inc()
+
 # Slowly reconnect
 self.retry(connector)
 
@@ -95,6 +121,11 @@
 
 self.report("%s lost." % self._report_prefix(), level=logging.INFO)
 
+self.idleconnection_metrics['connections_lost_total'].labels(
+reason=reason.type.__name__,
+**self.metric_labels
+).inc()
+
 # Slowly reconnect
 self.retry(connector)
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9acbcd2c859cc9213e40b7f7019a85be49ca72f8
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/pybal
Gerrit-Branch: master
Gerrit-Owner: Mark Bergsma 
Gerrit-Reviewer: Ema 
Gerrit-Reviewer: Giuseppe Lavagetto 
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...pybal[master]: Add monitoring specific metric to IdleConnection

2017-08-10 Thread Mark Bergsma (Code Review)
Mark Bergsma has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371117 )

Change subject: Add monitoring specific metric to IdleConnection
..

Add monitoring specific metric to IdleConnection

pybal_monitor_idleconnection_connections_failed_total counts connections
failing to establish.
pybal_monitor_idleconnection_connections_lost_total counts connections
lost for unclean reasons.

Bug: T171710
Change-Id: I9acbcd2c859cc9213e40b7f7019a85be49ca72f8
---
M pybal/monitors/idleconnection.py
1 file changed, 31 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/debs/pybal 
refs/changes/17/371117/1

diff --git a/pybal/monitors/idleconnection.py b/pybal/monitors/idleconnection.py
index 16bde75..04f6dc3 100644
--- a/pybal/monitors/idleconnection.py
+++ b/pybal/monitors/idleconnection.py
@@ -6,6 +6,7 @@
 """
 
 from pybal import monitor, util
+from pybal.metrics import Counter
 
 from twisted.internet import reactor, protocol
 import logging
@@ -31,6 +32,26 @@
 KEEPALIVE_INTERVAL = 30
 
 __name__ = 'IdleConnection'
+
+metric_labelnames = ('service', 'host', 'monitor')
+metric_keywords = {
+'namespace': 'pybal',
+'subsystem': 'monitor_' + __name__.lower()
+}
+
+idleconnection_metrics = {
+'connections_failed_total': Counter(
+'connections_failed_total',
+'Connections failed to establish',
+labelnames=metric_labelnames + ('reason',),
+**metric_keywords),
+'connections_lost_total': Counter(
+'connections_lost_total',
+'Connections lost uncleanly',
+labelnames=metric_labelnames + ('reason',),
+**metric_keywords)
+}
+
 
 def __init__(self, coordinator, server, configuration):
 """Constructor"""
@@ -76,6 +97,11 @@
 
 self.report("%s failed." % self._report_prefix(), level=logging.WARN)
 
+self.idleconnection_metrics['connections_failed_total'].labels(
+reason=reason.type.__name__,
+**self.metric_labels
+).inc()
+
 # Slowly reconnect
 self.retry(connector)
 
@@ -95,6 +121,11 @@
 
 self.report("%s lost." % self._report_prefix(), level=logging.INFO)
 
+self.idleconnection_metrics['connections_lost_total'].labels(
+reason=reason.type.__name__,
+**self.metric_labels
+).inc()
+
 # Slowly reconnect
 self.retry(connector)
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9acbcd2c859cc9213e40b7f7019a85be49ca72f8
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/pybal
Gerrit-Branch: master
Gerrit-Owner: Mark Bergsma 

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


[MediaWiki-commits] [Gerrit] operations...pybal[master]: Add monitoring specific metric to IdleConnection

2017-08-10 Thread Mark Bergsma (Code Review)
Mark Bergsma has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371110 )

Change subject: Add monitoring specific metric to IdleConnection
..

Add monitoring specific metric to IdleConnection

Counter connection_failed_total counts connections ending for
unclean reasons.

Bug: T171710
Change-Id: I07809ba636b02a634e91ec86e12215bc9b8b1ad6
---
M pybal/monitors/idleconnection.py
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/debs/pybal 
refs/changes/10/371110/1

diff --git a/pybal/monitors/idleconnection.py b/pybal/monitors/idleconnection.py
index fd105dd..5c40751 100644
--- a/pybal/monitors/idleconnection.py
+++ b/pybal/monitors/idleconnection.py
@@ -6,6 +6,7 @@
 """
 
 from pybal import monitor
+from pybal.metrics import Counter
 
 from twisted.internet import reactor, protocol
 import logging
@@ -30,6 +31,21 @@
 KEEPALIVE_INTERVAL = 30
 
 __name__ = 'IdleConnection'
+
+metric_labelnames = ('service', 'host', 'monitor')
+metric_keywords = {
+'namespace': 'pybal',
+'subsystem': 'monitor_' + __name__.lower()
+}
+
+idleconnection_metrics = {
+'connection_failed_total': Counter(
+'connection_failed_total',
+'HTTP(S) request duration',
+labelnames=metric_labelnames,
+**metric_keywords)
+}
+
 
 def __init__(self, coordinator, server, configuration):
 """Constructor"""
@@ -75,6 +91,10 @@
 
 self.report("%s failed." % self._report_prefix(), level=logging.WARN)
 
+self.idleconnection_metrics['connection_failed_total'].labels(
+**self.metric_labels
+).inc()
+
 # Slowly reconnect
 self.retry(connector)
 
@@ -94,6 +114,10 @@
 
 self.report("%s lost." % self._report_prefix(), level=logging.INFO)
 
+self.idleconnection_metrics['connection_failed_total'].labels(
+**self.metric_labels
+).inc()
+
 # Slowly reconnect
 self.retry(connector)
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07809ba636b02a634e91ec86e12215bc9b8b1ad6
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/pybal
Gerrit-Branch: master
Gerrit-Owner: Mark Bergsma 

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