[MediaWiki-commits] [Gerrit] operations/puppet[production]: Revert "Revert "hhvm: remove ganglia monitoring""

2017-11-22 Thread Dzahn (Code Review)
Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/392764 )

Change subject: Revert "Revert "hhvm: remove ganglia monitoring""
..


Revert "Revert "hhvm: remove ganglia monitoring""

This reverts commit 3ee659a1db5c8a655d3cf189df25ae505f663def.

Bug: T177225
Change-Id: I1c9a17d274067aada470c7f4d8765b058730b0f3
---
D modules/hhvm/files/monitoring/hhvm_health.py
D modules/hhvm/files/monitoring/hhvm_health.pyconf
D modules/hhvm/files/monitoring/hhvm_mem.py
D modules/hhvm/files/monitoring/hhvm_mem.pyconf
M modules/hhvm/manifests/monitoring.pp
5 files changed, 1 insertion(+), 378 deletions(-)

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



diff --git a/modules/hhvm/files/monitoring/hhvm_health.py 
b/modules/hhvm/files/monitoring/hhvm_health.py
deleted file mode 100644
index 763dfcd..000
--- a/modules/hhvm/files/monitoring/hhvm_health.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-  Ganglia metric-gathering module for HHVM health stats
-
-"""
-import json
-import logging
-import re
-import sys
-import time
-import urllib2
-
-
-logging.basicConfig(level=logging.INFO, stream=sys.stderr)
-
-
-def flatten(mapping, prefix=''):
-flat = {}
-for k, v in mapping.items():
-k = prefix + re.sub('\W', '', k.replace(' ', '_'))
-flat.update(flatten(v, k + '.') if isinstance(v, dict) else {k: v})
-return flat
-
-
-class HealthStats(object):
-def __init__(self, url, expiry=5):
-self.url = url
-self.expiry = expiry
-self.data = {}
-self.update()
-
-def update(self):
-try:
-req = urllib2.urlopen(self.url)
-res = flatten(json.load(req), 'HHVM.')
-self.data.update(res)
-self.last_fetched = time.time()
-except (AttributeError, EnvironmentError, ValueError):
-logging.exception('Failed to update stats:')
-
-def expired(self):
-return time.time() - self.last_fetched > self.expiry
-
-def get(self, stat):
-if self.expired():
-self.update()
-return self.data[stat]
-
-
-def guess_unit(metric):
-if 'size' in metric or 'capac' in metric or 'byte' in metric:
-return 'bytes'
-return 'count'
-
-
-def metric_init(params):
-url = params.get('url', 'http://localhost:9002/check-health')
-stats = HealthStats(url)
-return [{
-'name': str(key),
-'value_type': 'uint',
-'format': '%u',
-'units': guess_unit(key),
-'slope': 'both',
-'groups': 'HHVM',
-'call_back': stats.get,
-} for key in stats.data]
-
-
-def metric_cleanup():
-pass
-
-
-def self_test():
-params = dict(arg.split('=') for arg in sys.argv[1:])
-metrics = metric_init(params)
-while 1:
-for metric in metrics:
-name = metric['name']
-call_back = metric['call_back']
-logging.info('%s: %s', name, call_back(name))
-time.sleep(5)
-
-
-if __name__ == '__main__':
-self_test()
diff --git a/modules/hhvm/files/monitoring/hhvm_health.pyconf 
b/modules/hhvm/files/monitoring/hhvm_health.pyconf
deleted file mode 100644
index 6c898a3..000
--- a/modules/hhvm/files/monitoring/hhvm_health.pyconf
+++ /dev/null
@@ -1,96 +0,0 @@
-# Ganglia metric module for HHVM health statistics.
-
-modules {
-module {
-name = "hhvm_health"
-language = "python"
-}
-}
-
-collection_group {
-collect_every  = 20
-time_threshold = 60
-
-metric {
-name= "HHVM.targetcache"
-title   = "Target Cache"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.tcprofsize"
-title   = "Translation Cache - Prof Size"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.units"
-title   = "Units"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.tcfrozensize"
-title   = "Translation Cache - Frozen Size"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.hhbcroarenacapac"
-title   = "HHBC RO Arena Capacity"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.rds"
-title   = "RDS"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.tchotsize"
-title   = "Translation Cache - Hot Size"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.funcs"
-title   = "Funcs"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.queued"
-title   = "Queued"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.tcsize"
-

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Revert "Revert "hhvm: remove ganglia monitoring""

2017-11-21 Thread Dzahn (Code Review)
Hello Giuseppe Lavagetto, jenkins-bot, Volans,

I'd like you to do a code review.  Please visit

https://gerrit.wikimedia.org/r/392764

to review the following change.


Change subject: Revert "Revert "hhvm: remove ganglia monitoring""
..

Revert "Revert "hhvm: remove ganglia monitoring""

This reverts commit 3ee659a1db5c8a655d3cf189df25ae505f663def.

Change-Id: I1c9a17d274067aada470c7f4d8765b058730b0f3
---
D modules/hhvm/files/monitoring/hhvm_health.py
D modules/hhvm/files/monitoring/hhvm_health.pyconf
D modules/hhvm/files/monitoring/hhvm_mem.py
D modules/hhvm/files/monitoring/hhvm_mem.pyconf
M modules/hhvm/manifests/monitoring.pp
5 files changed, 1 insertion(+), 378 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/64/392764/1

diff --git a/modules/hhvm/files/monitoring/hhvm_health.py 
b/modules/hhvm/files/monitoring/hhvm_health.py
deleted file mode 100644
index 763dfcd..000
--- a/modules/hhvm/files/monitoring/hhvm_health.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-  Ganglia metric-gathering module for HHVM health stats
-
-"""
-import json
-import logging
-import re
-import sys
-import time
-import urllib2
-
-
-logging.basicConfig(level=logging.INFO, stream=sys.stderr)
-
-
-def flatten(mapping, prefix=''):
-flat = {}
-for k, v in mapping.items():
-k = prefix + re.sub('\W', '', k.replace(' ', '_'))
-flat.update(flatten(v, k + '.') if isinstance(v, dict) else {k: v})
-return flat
-
-
-class HealthStats(object):
-def __init__(self, url, expiry=5):
-self.url = url
-self.expiry = expiry
-self.data = {}
-self.update()
-
-def update(self):
-try:
-req = urllib2.urlopen(self.url)
-res = flatten(json.load(req), 'HHVM.')
-self.data.update(res)
-self.last_fetched = time.time()
-except (AttributeError, EnvironmentError, ValueError):
-logging.exception('Failed to update stats:')
-
-def expired(self):
-return time.time() - self.last_fetched > self.expiry
-
-def get(self, stat):
-if self.expired():
-self.update()
-return self.data[stat]
-
-
-def guess_unit(metric):
-if 'size' in metric or 'capac' in metric or 'byte' in metric:
-return 'bytes'
-return 'count'
-
-
-def metric_init(params):
-url = params.get('url', 'http://localhost:9002/check-health')
-stats = HealthStats(url)
-return [{
-'name': str(key),
-'value_type': 'uint',
-'format': '%u',
-'units': guess_unit(key),
-'slope': 'both',
-'groups': 'HHVM',
-'call_back': stats.get,
-} for key in stats.data]
-
-
-def metric_cleanup():
-pass
-
-
-def self_test():
-params = dict(arg.split('=') for arg in sys.argv[1:])
-metrics = metric_init(params)
-while 1:
-for metric in metrics:
-name = metric['name']
-call_back = metric['call_back']
-logging.info('%s: %s', name, call_back(name))
-time.sleep(5)
-
-
-if __name__ == '__main__':
-self_test()
diff --git a/modules/hhvm/files/monitoring/hhvm_health.pyconf 
b/modules/hhvm/files/monitoring/hhvm_health.pyconf
deleted file mode 100644
index 6c898a3..000
--- a/modules/hhvm/files/monitoring/hhvm_health.pyconf
+++ /dev/null
@@ -1,96 +0,0 @@
-# Ganglia metric module for HHVM health statistics.
-
-modules {
-module {
-name = "hhvm_health"
-language = "python"
-}
-}
-
-collection_group {
-collect_every  = 20
-time_threshold = 60
-
-metric {
-name= "HHVM.targetcache"
-title   = "Target Cache"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.tcprofsize"
-title   = "Translation Cache - Prof Size"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.units"
-title   = "Units"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.tcfrozensize"
-title   = "Translation Cache - Frozen Size"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.hhbcroarenacapac"
-title   = "HHBC RO Arena Capacity"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.rds"
-title   = "RDS"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.tchotsize"
-title   = "Translation Cache - Hot Size"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.funcs"
-title   = "Funcs"
-value_threshold = 1.0
-}
-
-
-metric {
-name= "HHVM.queued"
-title   = "Queued"
-value_threshold =