-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[query] Remove empty series from output when dropping NaNs #1682
Conversation
|
||
return filtered | ||
} | ||
|
||
func renderResultsJSON( | ||
w io.Writer, | ||
series []*ts.Series, | ||
params models.RequestParams, | ||
keepNans bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ever true? If not, can we remove the option entirely perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty happy to remove it since I don't really know why you'd want to keep nans, but you'll have to convert Ben :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, if you're asking if it can theoretically be true, there's a config option to keep nans in the output; don't know why anyone would turn it on, but it's there :p
@@ -240,12 +240,37 @@ func parseQuery(r *http.Request) (string, error) { | |||
return queries[0], nil | |||
} | |||
|
|||
func sanitizeSeries(series []*ts.Series) []*ts.Series { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we rename this perhaps just to removeAllNaNsSeries(...)
or similar? Not clear what sanitize does from just the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to filterNaNSeries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM to me other than nits
What this PR does / why we need it:
Drops empty series from appearing in output when keepNaNs option is set to disabled. This is important for functions like
topk
, which leave a lot of empty series and can crash Grafana.Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: