Merge "Raise CollectError when Prometheus query returns an error"
This commit is contained in:
commit
9f361499fc
@ -219,6 +219,11 @@ class PrometheusCollector(collector.BaseCollector):
|
|||||||
except PrometheusResponseError as e:
|
except PrometheusResponseError as e:
|
||||||
raise CollectError(*e.args)
|
raise CollectError(*e.args)
|
||||||
|
|
||||||
|
if res['status'] == 'error':
|
||||||
|
error_type = res['errorType']
|
||||||
|
error_msg = res['error']
|
||||||
|
raise CollectError("%s: %s" % (error_type, error_msg))
|
||||||
|
|
||||||
# If the query returns an empty dataset,
|
# If the query returns an empty dataset,
|
||||||
# return an empty list
|
# return an empty list
|
||||||
if not res['data']['result']:
|
if not res['data']['result']:
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Raises a ``CollectError`` exception with error details when a Prometheus
|
||||||
|
query returns an error status.
|
Loading…
Reference in New Issue
Block a user