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

Replace deprecated moving_avg by moving_fn aggregation #25386

Closed
wants to merge 3 commits into from

Conversation

timroes
Copy link
Contributor

@timroes timroes commented Nov 8, 2018

Summary

Fixes the first part of #24702 (TSVB still needs to be converted)

This will replace the now deprecated moving_avg aggregation by the new moving_fn but use the same script and window size that we used beforehand as default.

QA: This PR should not change any functionality.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@timroes timroes added release_note:enhancement Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Nov 8, 2018
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@elasticmachine
Copy link
Contributor

💔 Build Failed

@timroes
Copy link
Contributor Author

timroes commented Nov 8, 2018

Jenkins, test this

[kibana-ci-immutable-centos-1541686757852703365] uncaught exception in thread [main]
15:44:28    │      org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to load plugin class [org.elasticsearch.xpack.core.XPackPlugin]

@elasticmachine

This comment has been minimized.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@timroes
Copy link
Contributor Author

timroes commented Nov 8, 2018

Jenkins, test this

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

I've tested with exactly the same data on this PR and on 6.4
The visual results are different when we don't have continuous buckets on all intervals.
Changing the getValue to return null values instead of 0 will fix the problem. (also because 0 is anyway a value, and null means 'we cannot compute that value')

viz in 6.4
screen shot 2018-11-09 at 10 03 40

Viz in current PR
screen shot 2018-11-09 at 10 03 33

ps: you can see another intersting bug on 6.4 where the moving average metric, collapsed without a title on the editor :(

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@lukeelmers
Copy link
Member

code lgtm. i tested the PR and compared with current master using the same data.

i noticed some slight differences still; see below. on master it seems the moving avg starts at 0 at the beginning of the data set, which affects the first few points due to the size of the moving avg window. and in this PR there simply isn't a moving avg entry for the first point.

it seems to me the behavior in this PR is what we would want anyway, but just wanted to highlight the differences.

this pr
screenshot 2018-11-09 11 25 42

master
screenshot 2018-11-09 11 27 35

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

I think we need to go back again on that gap policy, because I think we need to have a different approach than the one you wrote

* here, that preserves the null value, to be closer aligned with
* the previous implementation.
*/
return bucket[agg.id] ? bucket[agg.id].value : 0;
Copy link
Member

Choose a reason for hiding this comment

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

@timroes I don't think this is what we specified on our call.

The problem here is the following:

  • the current default, 7.0, gap_policy of the moving function is to skip. This means that the function add zeros to every null value on that window, and than return the average. It's not what you wrote here, that return a zero value for buckets with an empty value. A bucket is always a average representation of N values, if the average of these N values is 0 than the bucket value is 0, if not it will be some other number. If the gap_policy is configured to skip, than it will skip the bucket calculation, returning a null bucket, that doesn't have to be confused with a 0 value average.

This is your implementation (that use the skip gap policy)
screen shot 2018-11-12 at 12 26 47

This is the one with the line configured as we spoked:
return bucket[agg.id] ? bucket[agg.id].value : null;
screen shot 2018-11-12 at 12 29 25

As you can see the values are the same expect that you bring down the curve on the empty bucket, instead of leaving the curve to skip that bucket and continue to the next.

This is your implementation with inserting zeros
screen shot 2018-11-12 at 12 28 37

And this is my implementation with inserting zeros that are exactly the same as yours:
screen shot 2018-11-12 at 12 30 11

@elasticmachine
Copy link
Contributor

💔 Build Failed

@lukeelmers
Copy link
Member

Looks like moving_avg is broken on master now that elastic/elasticsearch#39328 has landed, so we should probably merge this soon.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@timroes
Copy link
Contributor Author

timroes commented Mar 25, 2019

As @lukeelmers mentioned, we need to pick this up again. @markov00 I am a bit lost on our last decisions here. Do you still remember which implementation we aimed for now?

@timroes
Copy link
Contributor Author

timroes commented Mar 29, 2019

Will be closing in favor of another PR, Marco is doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants