Update Prometheus query function to include timeout parameter
Some checks failed
CI / ci (push) Has been cancelled
Some checks failed
CI / ci (push) Has been cancelled
- Added a timeout parameter to the requests.get call in the query_prometheus function to enhance reliability and prevent hanging requests.
This commit is contained in:
@@ -29,7 +29,7 @@ def query_prometheus(query: str) -> str | list[str]:
|
|||||||
params = {
|
params = {
|
||||||
"query": query,
|
"query": query,
|
||||||
}
|
}
|
||||||
response = requests.get(url=url, params=params)
|
response = requests.get(url=url, params=params, timeout=CHECK_TIMEOUT)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
result = response.json()["data"]["result"]
|
result = response.json()["data"]["result"]
|
||||||
if len(result) > 1:
|
if len(result) > 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user