From f71394423fcbe63900e046f36beed59d5e517e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Ramalho?= Date: Tue, 16 May 2017 13:43:09 -0300 Subject: [PATCH] Change dimension 'service' to 'component' on HAProxy plugin Following the pattern of other plugins, the 'service' dimension is generally used to identify which service is providing the metrics, and the 'component' dimension is used to identify specifically wich component of the service is being monitored. Example: monasca_agent: service=monitoring component=monasca-agent This patch applies this same concept to the HAProxy plugin by changing the service dimension value to 'service=haproxy' and adding a 'component' dimension 'component=haproxy_[back|front]end_name' TLDR: The following dimension will be changed from: service='haproxy_[back|front]end_name' to: service=haproxy component='haproxy_[back|front]end_name' Change-Id: Ic5203a607d9d0bec06f5e4a542d68dda3a3b67ba --- monasca_agent/collector/checks_d/haproxy.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/monasca_agent/collector/checks_d/haproxy.py b/monasca_agent/collector/checks_d/haproxy.py index 7d16d2f6..fc590556 100644 --- a/monasca_agent/collector/checks_d/haproxy.py +++ b/monasca_agent/collector/checks_d/haproxy.py @@ -50,7 +50,7 @@ class HAProxy(AgentCheck): } def check(self, instance): - self.dimensions = self._set_dimensions(None, instance) + self.dimensions = self._set_dimensions({'service': 'haproxy'}, instance) url = instance.get('url') username = instance.get('username') password = instance.get('password') @@ -156,7 +156,7 @@ class HAProxy(AgentCheck): for (service, status), count in hosts_statuses.items(): status = status.lower() - status_dimensions.update({'status': status, 'service': service}) + status_dimensions.update({'status': status, 'component': service}) self.gauge("haproxy.count_per_status", count, dimensions=status_dimensions) if 'up' in status: @@ -166,7 +166,7 @@ class HAProxy(AgentCheck): for service in agg_statuses: for status, count in agg_statuses[service].items(): - status_dimensions.update({'status': status, 'service': service}) + status_dimensions.update({'status': status, 'component': service}) self.gauge("haproxy.count_per_status", count, dimensions=status_dimensions) def _process_metrics(self, data_list, service, url): @@ -188,8 +188,7 @@ class HAProxy(AgentCheck): metric_dimensions.update({'type': service, 'instance_url': url, - 'service_name': service_name, - 'service': 'haproxy'}) + 'component': service_name}) if service == Services.BACKEND: metric_dimensions.update({'backend': hostname})