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] Fix Graphite moving functions to include series not in the query but matched by expanded range #3149

Conversation

robskillington
Copy link
Collaborator

@robskillington robskillington commented Feb 1, 2021

What this PR does / why we need it:

Previously the moving functions only included datapoints for series that had data in the original time window (plus the shifted values from the moving function window) but was missing datapoints for series that did not have any data in the new time window (but had shifted values from the moving function window).

Decided to also take opportunity to port movingAverage to the new moving helper but kept exponentialMovingAverage where it is since it has significantly different semantics on the windowing and setup for each series.

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

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

NONE

…ed data with original query fetched time window
// SafeAverage returns the average of the input slice the number of NaNs in the input.
func SafeAverage(input []float64) (float64, int) {
sum, nans := SafeSum(input)
count := len(input) - nans
Copy link
Collaborator

Choose a reason for hiding this comment

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

can they all be NaNs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm good call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Seems like this is actually safe:
https://play.golang.org/p/MhMnzAReOd1

@robskillington robskillington enabled auto-merge (squash) March 17, 2021 22:59
@codecov
Copy link

codecov bot commented Mar 17, 2021

Codecov Report

Merging #3149 (6b91769) into master (6b91769) will not change coverage.
The diff coverage is n/a.

❗ Current head 6b91769 differs from pull request most recent head 4b00e0f. Consider uploading reports for the commit 4b00e0f to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3149   +/-   ##
=======================================
  Coverage    72.4%    72.4%           
=======================================
  Files        1099     1099           
  Lines      102294   102294           
=======================================
  Hits        74064    74064           
  Misses      23123    23123           
  Partials     5107     5107           
Flag Coverage Δ
aggregator 76.8% <0.0%> (ø)
cluster 84.9% <0.0%> (ø)
collector 84.3% <0.0%> (ø)
dbnode 78.9% <0.0%> (ø)
m3em 74.4% <0.0%> (ø)
m3ninx 73.5% <0.0%> (ø)
metrics 19.7% <0.0%> (ø)
msg 74.6% <0.0%> (ø)
query 67.1% <0.0%> (ø)
x 80.3% <0.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b91769...4b00e0f. Read the comment docs.

@robskillington robskillington merged commit 8df132f into master Mar 18, 2021
@robskillington robskillington deleted the r/fix-moving-functions-with-bootstrap-and-original-series-mismatch branch March 18, 2021 00:14
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