Skip to content

Commit 0a45ee4

Browse files
4n4ndCopilot
andauthored
Update prometheus_api_client/metric.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6e2eeee commit 0a45ee4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

prometheus_api_client/metric.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ def __init__(self, metric, oldest_data_datetime=None):
5454
self.metric_values = metric.metric_values
5555
self.oldest_data_datetime = oldest_data_datetime
5656
else:
57-
self.metric_name = metric["metric"].pop("__name__", None)
57+
self.metric_name = metric["metric"].get("__name__", None)
5858
self.label_config = deepcopy(metric["metric"])
59+
if "__name__" in self.label_config:
60+
del self.label_config["__name__"]
5961
self.oldest_data_datetime = oldest_data_datetime
6062

6163
# if it is a single value metric change key name

0 commit comments

Comments
 (0)