Merge "Fix empty metadata exception in Prometheus collector"

This commit is contained in:
Zuul 2020-09-10 15:45:04 +00:00 committed by Gerrit Code Review
commit 15e88c8c3a
2 changed files with 6 additions and 1 deletions

View File

@ -130,7 +130,7 @@ class PrometheusCollector(collector.BaseCollector):
"""
metadata = {}
for meta in self.conf[metric_name]['metadata']:
metadata[meta] = data['metric'][meta]
metadata[meta] = data['metric'].get(meta, '')
groupby = {scope_key: scope_id}
for meta in self.conf[metric_name]['groupby']:

View File

@ -0,0 +1,5 @@
---
issues:
- |
Fixes exceptions in Prometheus collector when metadata defined in
``metrics.yml`` is not present on metrics retrieved from Prometheus.