You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a ScaledObject with a New Relic trigger with a query that isn't returning any results. Upon creating this scaler keda-operator pod logs a panic instead of correctly handling no results and returning 0 (or error). Not an authentication issue as other workloads with valid queries scale with no issue. I have found similar issues related to panics on the New Relic Scaler in the past, but none that correlated directly with query execution.
Expected Behavior
Scaler returns 0 or error (if noMetadataError is active)
Actual Behavior
Keda panics and operator enters a CrashLoopBackoff until query scaler is adjusted or removed
Steps to Reproduce the Problem
This is the problematic query: SELECT latest(MyMetric.value) FROM MyMetric WHERE metricName = 'something' FACET host
which produces such a result in the New Relic UI:
If we remove the faceting, the response is slightly different (and causes no panic):
Given the stack, I looked into the source code and this line seems to be the origin, as there are no actual results to go through in the original query's scenario (not sure why, lack of support in New Relic's library?); I believe something like this would be an easy fix:
iflen(resp.Results) ==0 {
ifs.metadata.noDataError {
return0, fmt.Errorf("query return no results %s", s.metadata.nrql)
}
return0, nil
}
// Only use the first result from the query, as the query should not be multi rowfor_, v:=rangeresp.Results[0] {
val, ok:=v.(float64)
ifok {
returnval, nil
}
}
...
I'd be happy to open a contribution if indeed it would be a possible way to go
The text was updated successfully, but these errors were encountered:
hey @cyrilico
Thanks for reporting! I thought that empty responses raise and error, but apparently they don't. Are you willing to open a PR with your fix?
Report
I have a ScaledObject with a New Relic trigger with a query that isn't returning any results. Upon creating this scaler keda-operator pod logs a panic instead of correctly handling no results and returning 0 (or error). Not an authentication issue as other workloads with valid queries scale with no issue. I have found similar issues related to panics on the New Relic Scaler in the past, but none that correlated directly with query execution.
Expected Behavior
Scaler returns 0 or error (if noMetadataError is active)
Actual Behavior
Keda panics and operator enters a CrashLoopBackoff until query scaler is adjusted or removed
Steps to Reproduce the Problem
This is the problematic query:
SELECT latest(MyMetric.value) FROM MyMetric WHERE metricName = 'something' FACET host
which produces such a result in the New Relic UI:
If we remove the faceting, the response is slightly different (and causes no panic):
Logs from KEDA operator
KEDA Version
2.13.1
Kubernetes Version
1.26
Platform
Amazon Web Services
Scaler Details
New Relic
Anything else?
Given the stack, I looked into the source code and this line seems to be the origin, as there are no actual results to go through in the original query's scenario (not sure why, lack of support in New Relic's library?); I believe something like this would be an easy fix:
I'd be happy to open a contribution if indeed it would be a possible way to go
The text was updated successfully, but these errors were encountered: