mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 12:11:26 +00:00
fix: change _send_query to make use of 'data' field in response of prometheus
This commit is contained in:
parent
4bf206ad48
commit
eca1bc78ba
|
@ -36,8 +36,11 @@ class PrometheusQueries:
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
raise Exception("Prometheus returned unexpected HTTP status code")
|
raise Exception("Prometheus returned unexpected HTTP status code")
|
||||||
json = response.json()
|
json = response.json()
|
||||||
|
if json['status'] != 'success':
|
||||||
|
raise Exception("Prometheus returned unexpected status")
|
||||||
|
result = json['data']
|
||||||
return PrometheusQueryResult(
|
return PrometheusQueryResult(
|
||||||
result_type=json['result_type'], result=json['result']
|
result_type=result['result_type'], result=result['result']
|
||||||
)
|
)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
raise Exception("Prometheus request failed! " + str(error))
|
raise Exception("Prometheus request failed! " + str(error))
|
||||||
|
|
Loading…
Reference in a new issue