Skip to content
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

Merged
merged 2 commits into from
May 30, 2019

Conversation

arnikola
Copy link
Collaborator

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?:

Will no longer add empty series to output

Does this PR require updating code package or user-facing documentation?:

NONE


return filtered
}

func renderResultsJSON(
w io.Writer,
series []*ts.Series,
params models.RequestParams,
keepNans bool,
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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 {
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to filterNaNSeries

Copy link
Collaborator

@robskillington robskillington left a 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

@arnikola arnikola merged commit 68580c0 into master May 30, 2019
@arnikola arnikola deleted the arnikola/drop-series branch May 30, 2019 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants