Ottomata has submitted this change and it was merged. Change subject: Monitor Elasticsearch query stats groups ......................................................................
Monitor Elasticsearch query stats groups Only really useful when we start making these groups. Change-Id: I34b1de807038474b99f05daf3f41b2395b431a0a Needs: Ifaa1e45b95cb2e7ba7199675d8553b07a8215abc from cirrus --- M modules/elasticsearch/files/ganglia/elasticsearch_monitoring.py 1 file changed, 43 insertions(+), 1 deletion(-) Approvals: Ottomata: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/modules/elasticsearch/files/ganglia/elasticsearch_monitoring.py b/modules/elasticsearch/files/ganglia/elasticsearch_monitoring.py index 2b8690b..be30ce3 100644 --- a/modules/elasticsearch/files/ganglia/elasticsearch_monitoring.py +++ b/modules/elasticsearch/files/ganglia/elasticsearch_monitoring.py @@ -389,6 +389,27 @@ 'description': 'shards initializing' }) +# Index stats +index_stats = dict() +index_stats['es_%(group)s_queries'] = merge(COUNTER, { + 'path': '_all.total.search.groups.%(group)s.query_total', + 'units': 'queries/sec', + 'description': 'Queries/sec', +}) +index_stats['es_%(group)s_query_time'] = merge(TIME, { + 'path': '_all.total.search.groups.%(group)s.query_time_in_millis', + 'description': 'Query Time/sec' +}) +index_stats['es_%(group)s_fetches'] = merge(COUNTER, { + 'path': '_all.total.search.groups.%(group)s.fetch_total', + 'units': 'fetches/sec', + 'description': 'Fetches/sec', +}) +index_stats['es_%(group)s_fetch_time'] = merge(TIME, { + 'path': '_all.total.search.groups.%(group)s.fetch_time_in_millis', + 'description': 'Fetch Time/sec' +}) + def dig_it_up(obj, path): def tryint(s): @@ -404,12 +425,16 @@ return False +def load(url): + return json.load(urllib2.urlopen(url, None, 2)) + + def update_result(data): # If time delta is > 3 seconds, then update the JSON results now = time.time() diff = now - data['last_update'] if diff > 3: - data['stats'] = json.load(urllib2.urlopen(data['url'], None, 2)) + data['stats'] = load(data['url']) data['last_update'] = now @@ -470,6 +495,23 @@ Desc_Skel['call_back'] = partial(get_stat, health_result, health_stats) init(health_stats) + # Monitor search grouped stats by making a stat per group. + url = '{0}_stats/search?groups=_all'.format(host) + index_stats_result = { + 'last_update': 0, + 'url': url, + 'path_transformer': noop_path_transformer, + } + for group in load(url)['_all']['total']['search']['groups']: + group_index_stats = dict() + for stat_name, stat in index_stats.iteritems(): + stat_name = stat_name % {'group': group.replace(' ', '_')} + path = stat['path'] % {'group': group} + group_index_stats[stat_name] = merge(stat, {'path': path}) + Desc_Skel['call_back'] = partial( + get_stat, index_stats_result, group_index_stats) + init(group_index_stats) + return descriptors -- To view, visit https://gerrit.wikimedia.org/r/108852 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I34b1de807038474b99f05daf3f41b2395b431a0a Gerrit-PatchSet: 4 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: Ottomata <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits