File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ async def metrics(self) -> dict[str, UptimeKumaMonitor]:
7070 If there is a connection error, timeout, or other client error during the
7171 request.
7272 """
73- monitors : dict [str , dict [str , Any ]] = {}
73+ monitors : dict [str , dict [str | int , Any ]] = {}
7474 url = self ._base_url / "metrics"
7575
7676 try :
@@ -96,7 +96,11 @@ async def metrics(self) -> dict[str, UptimeKumaMonitor]:
9696 if not metric .name .startswith ("monitor" ):
9797 continue
9898 for sample in metric .samples :
99- key = sample .labels .get ("monitor_id" , sample .labels ["monitor_name" ])
99+ key = (
100+ int (monitor_id )
101+ if (monitor_id := sample .labels .get ("monitor_id" ))
102+ else sample .labels ["monitor_name" ]
103+ )
100104
101105 monitors .setdefault (key , sample .labels ).update (
102106 {sample .name : sample .value }
You can’t perform that action at this time.
0 commit comments