From 8b04e2420f37f6ba3a14888c3c138ad87fcd5bbb Mon Sep 17 00:00:00 2001 From: Suresh Kumar Ponnusamy Date: Wed, 20 Jul 2022 16:12:55 +0530 Subject: [PATCH] promethues_scler: add url in error information Without the query its hard to debug which query is causing the error when there are hundreds of scalers. Signed-off-by: Suresh Kumar --- CHANGELOG.md | 1 + pkg/scalers/prometheus_scaler.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cec6c31d2a3..69877951cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ To learn more about our roadmap, we recommend reading [this document](ROADMAP.md - **AWS SQS Queue Scaler:** Support for scaling to include in-flight messages. ([#3133](https://github.com/kedacore/keda/issues/3133)) - **GCP Stackdriver Scaler:** Added aggregation parameters ([#3008](https://github.com/kedacore/keda/issues/3008)) - **Prometheus Scaler:** Add ignoreNullValues to return error when prometheus return null in values ([#3065](https://github.com/kedacore/keda/issues/3065)) +- **Prometheus Scaler:** Improve error reporting, include the failed query in error message ([#3406](https://github.com/kedacore/keda/pull/3406)) - **Selenium Grid Scaler:** Edge active sessions not being properly counted ([#2709](https://github.com/kedacore/keda/issues/2709)) - **Selenium Grid Scaler:** Max Sessions implementation issue ([#3061](https://github.com/kedacore/keda/issues/3061)) ### Fixes diff --git a/pkg/scalers/prometheus_scaler.go b/pkg/scalers/prometheus_scaler.go index 7a03ad1b1d3..3a6d8096637 100644 --- a/pkg/scalers/prometheus_scaler.go +++ b/pkg/scalers/prometheus_scaler.go @@ -228,7 +228,7 @@ func (s *prometheusScaler) ExecutePromQuery(ctx context.Context) (float64, error _ = r.Body.Close() if !(r.StatusCode >= 200 && r.StatusCode <= 299) { - return -1, fmt.Errorf("prometheus query api returned error. status: %d response: %s", r.StatusCode, string(b)) + return -1, fmt.Errorf("prometheus query api returned error. status: %d response: %s url: %s", r.StatusCode, string(b), url) } var result promQueryResult