Stitching things up

This commit is contained in:
2025-12-03 12:04:48 +03:00
parent 79bad39bd9
commit 4e37cd1ef8
37 changed files with 2183 additions and 2154 deletions

View File

@@ -0,0 +1,16 @@
import requests
from watcher_visio.settings import PROMETHEUS_URL
def query_prometheus(query):
url = f"{PROMETHEUS_URL}/api/v1/query"
params = {
"query": query,
}
response = requests.get(url=url, params=params)
response.raise_for_status()
result = response.json()["data"]["result"]
if len(result) > 1:
return result[0]["value"][1]
else:
return result[0]["values"]