From 756ddd8fbbd9df4714d5a78640ca87de5d396e3b Mon Sep 17 00:00:00 2001 From: MoritzWeber Date: Wed, 20 Nov 2024 11:22:57 +0100 Subject: [PATCH] fix: Convert Prometheus floating point numbers correctly to int Prometheus returns floats as strings, e.g., `16.5` is a valid idletime. This breaks the `int()` parsing since it can't handle floats as strings. --- backend/capellacollab/sessions/injection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/capellacollab/sessions/injection.py b/backend/capellacollab/sessions/injection.py index a89e26bd1..d0fa665df 100644 --- a/backend/capellacollab/sessions/injection.py +++ b/backend/capellacollab/sessions/injection.py @@ -36,7 +36,7 @@ def get_idle_state(sid: str) -> sessions_models2.IdleState: if len(response.json()["data"]["result"]) > 0: idle_for_minutes = int( - response.json()["data"]["result"][0]["value"][1] + float(response.json()["data"]["result"][0]["value"][1]) ) return sessions_models2.IdleState( available=True,