diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d253e1b17d..7a9c11d05df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,7 @@ Here is an overview of all new **experimental** features: - **General**: Prometheus metrics shows errors correctly ([#5597](https://github.com/kedacore/keda/issues/5597)) - **General**: Validate empty array value of triggers in ScaledObject/ScaledJob creation ([#5520](https://github.com/kedacore/keda/issues/5520)) - **GitHub Runner Scaler**: Fixed `in_progress` detection on running jobs instead of just `queued` ([#5604](https://github.com/kedacore/keda/issues/5604)) +- **New Relic Scaler**: Consider empty results set from query executer ([#5619](https://github.com/kedacore/keda/pull/5619)) ### Deprecations diff --git a/pkg/scalers/newrelic_scaler.go b/pkg/scalers/newrelic_scaler.go index 1d62ea911e6..851747a5beb 100644 --- a/pkg/scalers/newrelic_scaler.go +++ b/pkg/scalers/newrelic_scaler.go @@ -158,6 +158,13 @@ func (s *newrelicScaler) executeNewRelicQuery(ctx context.Context) (float64, err if err != nil { return 0, fmt.Errorf("error running NRQL %s (%s)", s.metadata.nrql, err.Error()) } + // Check for empty results set, as New Relic lib does not report these as errors + if len(resp.Results) == 0 { + if s.metadata.noDataError { + return 0, fmt.Errorf("query return no results %s", s.metadata.nrql) + } + return 0, nil + } // Only use the first result from the query, as the query should not be multi row for _, v := range resp.Results[0] { val, ok := v.(float64)