Skip to content

Commit

Permalink
fix: Convert Prometheus floating point numbers correctly to int
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MoritzWeber0 committed Nov 20, 2024
1 parent 5ff81fe commit 756ddd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/capellacollab/sessions/injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 756ddd8

Please sign in to comment.