Skip to content

Commit

Permalink
Fix kubernetes_state avoid tags collision
Browse files Browse the repository at this point in the history
  • Loading branch information
clamoriniere committed Jul 18, 2019
1 parent caa8e83 commit 3dca574
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _filter_metric(self, metric, scraper_config):
for sample in metric.samples:
if "namespace" in sample[self.SAMPLE_LABELS]:
ns = sample[self.SAMPLE_LABELS]["namespace"]
tags.append("kube_namespace:" + ns)
tags.append("namespace:" + ns)
break
self._send_telemetry_counter(
'collector.metrics.count', len(metric.samples), scraper_config, extra_tags=tags
Expand Down
6 changes: 2 additions & 4 deletions kubernetes_state/tests/test_kubernetes_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,9 @@ def test_telemetry(aggregator, instance):
aggregator.assert_metric(NAMESPACE + '.telemetry.metrics.ignored.count', tags=['optional:tag1'], value=76.0)
aggregator.assert_metric(
NAMESPACE + '.telemetry.collector.metrics.count',
tags=['name:pod', 'kube_namespace:default', 'optional:tag1'],
tags=['name:pod', 'namespace:default', 'optional:tag1'],
value=600.0,
)
aggregator.assert_metric(
NAMESPACE + '.telemetry.collector.metrics.count',
tags=['name:hpa', 'kube_namespace:ns1', 'optional:tag1'],
value=8.0,
NAMESPACE + '.telemetry.collector.metrics.count', tags=['name:hpa', 'namespace:ns1', 'optional:tag1'], value=8.0
)

0 comments on commit 3dca574

Please sign in to comment.