Skip to content

Commit

Permalink
Prometheus Exporter sanitize info metric
Browse files Browse the repository at this point in the history
  • Loading branch information
kornerc committed Dec 7, 2023
1 parent 3dfe224 commit d1c331c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ def _create_info_metric(
self, name: str, description: str, attributes: Dict[str, str]
) -> InfoMetricFamily:
"""Create an Info Metric Family with list of attributes"""
# sanitize the attribute names according to Prometheus rule
attributes = {self._sanitize(key): value for key, value in attributes.items()}
info = InfoMetricFamily(name, description, labels=attributes)
info.add_metric(labels=list(attributes.keys()), value=attributes)
return info
Expand Down

0 comments on commit d1c331c

Please sign in to comment.