From 021208a4d6636b8c0148c24b5ac29c6bb17c295a Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 29 Jul 2024 18:33:03 +0300 Subject: [PATCH] chore: Show the response text when prometheus request fails --- selfprivacy_api/utils/monitoring.py | 4 ++-- tests/data/turned_on.json | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/selfprivacy_api/utils/monitoring.py b/selfprivacy_api/utils/monitoring.py index 4771bfb..762e35a 100644 --- a/selfprivacy_api/utils/monitoring.py +++ b/selfprivacy_api/utils/monitoring.py @@ -70,7 +70,7 @@ class MonitoringQueries: ) if response.status_code != 200: return MonitoringQueryError( - error="Prometheus returned unexpected HTTP status code" + error=f"Prometheus returned unexpected HTTP status code. Error: {response.text}" ) json = response.json() if result_type and json["data"]["resultType"] != result_type: @@ -96,7 +96,7 @@ class MonitoringQueries: ) if response.status_code != 200: return MonitoringQueryError( - error="Prometheus returned unexpected HTTP status code" + error=f"Prometheus returned unexpected HTTP status code. Error: {response.text}" ) json = response.json() if result_type and json["data"]["resultType"] != result_type: diff --git a/tests/data/turned_on.json b/tests/data/turned_on.json index 9c285b1..a5241ec 100644 --- a/tests/data/turned_on.json +++ b/tests/data/turned_on.json @@ -65,6 +65,10 @@ }, "roundcube": { "enable": true + }, + "prometheus": { + "enable": true, + "location": "sdb" } }, "volumes": [