diff --git a/cloudkitty/collector/prometheus.py b/cloudkitty/collector/prometheus.py index 8217fef3..cc3adcb3 100644 --- a/cloudkitty/collector/prometheus.py +++ b/cloudkitty/collector/prometheus.py @@ -219,6 +219,11 @@ class PrometheusCollector(collector.BaseCollector): except PrometheusResponseError as e: 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, # return an empty list if not res['data']['result']: diff --git a/releasenotes/notes/prometheus-error-8eab9f1793c2280c.yaml b/releasenotes/notes/prometheus-error-8eab9f1793c2280c.yaml new file mode 100644 index 00000000..4f419092 --- /dev/null +++ b/releasenotes/notes/prometheus-error-8eab9f1793c2280c.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Raises a ``CollectError`` exception with error details when a Prometheus + query returns an error status.