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..0000000 --- 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..0000000 --- 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" - title = "Translation Cache - Size" - value_threshold = 1.0 - } - - - metric { - name = "HHVM.tccoldsize" - title = "Translation Cache - Cold Size" - value_threshold = 1.0 - } - - - metric { - name = "HHVM.load" - title = "Load" - value_threshold = 1.0 - } -} diff --git a/modules/hhvm/files/monitoring/hhvm_mem.py b/modules/hhvm/files/monitoring/hhvm_mem.py deleted file mode 100644 index 137b70c..0000000 --- a/modules/hhvm/files/monitoring/hhvm_mem.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Ganglia metric-gathering module for HHVM memory 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 MemoryStats(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)['Memory'], '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 metric_init(params): - url = params.get('url', 'http://localhost:9002/memory.json') - stats = MemoryStats(url) - return [{ - 'name': str(key), - 'value_type': 'uint', - 'format': '%u', - 'units': 'count' if 'count' in key.lower() else 'bytes', - '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_mem.pyconf b/modules/hhvm/files/monitoring/hhvm_mem.pyconf deleted file mode 100644 index 2856f02..0000000 --- a/modules/hhvm/files/monitoring/hhvm_mem.pyconf +++ /dev/null @@ -1,67 +0,0 @@ -# Ganglia metric module for HHVM memory statistics. - -modules { - module { - name = "hhvm_mem" - language = "python" - } -} - -collection_group { - collect_every = 20 - time_threshold = 60 - - metric { - name = "HHVM.Process_Stats_bytes.Shared" - title = "Memory - Process - Shared" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Process_Stats_bytes.TextCode" - title = "Memory - Process - TextCode" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Process_Stats_bytes.Data" - title = "Memory - Process - Data" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Process_Stats_bytes.VmRss" - title = "Memory - Process - VmRss" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Breakdown.Static_Strings.Bytes" - title = "Memory - Static Strings" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Process_Stats_bytes.VmSize" - title = "Memory - VmSize" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Breakdown.Unknown" - title = "Memory - Unknown" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Breakdown.Code.Bytes" - title = "Memory - Code" - value_threshold = 1.0 - } - - metric { - name = "HHVM.Breakdown.Static_Strings.Count" - title = "Memory - Static Strings Count" - value_threshold = 1.0 - } -} diff --git a/modules/hhvm/manifests/monitoring.pp b/modules/hhvm/manifests/monitoring.pp index 27e3691..868f2f4 100644 --- a/modules/hhvm/manifests/monitoring.pp +++ b/modules/hhvm/manifests/monitoring.pp @@ -1,6 +1,6 @@ # == Class: hhvm::monitoring # -# Provisions Ganglia metric-gathering modules for HHVM. +# Provisions Diamond collector for HHVM. # class hhvm::monitoring { include ::standard @@ -9,51 +9,5 @@ diamond::collector { 'HhvmApc': source => 'puppet:///modules/hhvm/monitoring/hhvm_apc.py', - } - - if $::standard::has_ganglia { - - include ::ganglia - - file { '/usr/lib/ganglia/python_modules/hhvm_mem.py': - source => 'puppet:///modules/hhvm/monitoring/hhvm_mem.py', - owner => 'root', - group => 'root', - mode => '0555', - require => Package['ganglia-monitor'], - } - - file { '/etc/ganglia/conf.d/hhvm_mem.pyconf': - source => 'puppet:///modules/hhvm/monitoring/hhvm_mem.pyconf', - owner => 'root', - group => 'root', - mode => '0444', - require => File['/usr/lib/ganglia/python_modules/hhvm_mem.py'], - notify => Service['ganglia-monitor'], - } - - } - - ## Health statistics - - if $::standard::has_ganglia { - - file { '/usr/lib/ganglia/python_modules/hhvm_health.py': - source => 'puppet:///modules/hhvm/monitoring/hhvm_health.py', - owner => 'root', - group => 'root', - mode => '0555', - require => Package['ganglia-monitor'], - } - - file { '/etc/ganglia/conf.d/hhvm_health.pyconf': - source => 'puppet:///modules/hhvm/monitoring/hhvm_health.pyconf', - owner => 'root', - group => 'root', - mode => '0444', - require => File['/usr/lib/ganglia/python_modules/hhvm_health.py'], - notify => Service['ganglia-monitor'], - } - } } -- To view, visit https://gerrit.wikimedia.org/r/392764 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1c9a17d274067aada470c7f4d8765b058730b0f3 Gerrit-PatchSet: 3 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Dzahn <dz...@wikimedia.org> Gerrit-Reviewer: Dzahn <dz...@wikimedia.org> Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@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