chore: Also show a query when prometheus fails

This commit is contained in:
Inex Code 2024-07-29 18:50:23 +03:00
parent 021208a4d6
commit 60ce3b773d

View file

@ -70,7 +70,7 @@ class MonitoringQueries:
) )
if response.status_code != 200: if response.status_code != 200:
return MonitoringQueryError( return MonitoringQueryError(
error=f"Prometheus returned unexpected HTTP status code. Error: {response.text}" error=f"Prometheus returned unexpected HTTP status code. Error: {response.text}. The query was {query}"
) )
json = response.json() json = response.json()
if result_type and json["data"]["resultType"] != result_type: if result_type and json["data"]["resultType"] != result_type:
@ -96,7 +96,7 @@ class MonitoringQueries:
) )
if response.status_code != 200: if response.status_code != 200:
return MonitoringQueryError( return MonitoringQueryError(
error=f"Prometheus returned unexpected HTTP status code. Error: {response.text}" error=f"Prometheus returned unexpected HTTP status code. Error: {response.text}. The query was {query}"
) )
json = response.json() json = response.json()
if result_type and json["data"]["resultType"] != result_type: if result_type and json["data"]["resultType"] != result_type: