Skip to content

Commit 83f5b70

Browse files
committed
Use monitor_id as key if available
1 parent 7856a2a commit 83f5b70

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pythonkuma/uptimekuma.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ async def metrics(self) -> dict[str, UptimeKumaMonitor]:
9696
if not metric.name.startswith("monitor"):
9797
continue
9898
for sample in metric.samples:
99-
if not (monitor_name := sample.labels.get("monitor_name")):
100-
continue
99+
key = sample.labels.get("monitor_id", sample.labels["monitor_name"])
101100

102-
monitors.setdefault(monitor_name, sample.labels).update(
101+
monitors.setdefault(key, sample.labels).update(
103102
{sample.name: sample.value}
104103
)
105104

0 commit comments

Comments
 (0)