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

[TSVB] Replace deprecated moving_avg by moving_fn aggregation #36624

Merged
merged 48 commits into from
Jun 19, 2019
Merged

[TSVB] Replace deprecated moving_avg by moving_fn aggregation #36624

merged 48 commits into from
Jun 19, 2019

Conversation

gospodarsky
Copy link
Contributor

@gospodarsky gospodarsky commented May 16, 2019

Fix: #36520

Summary

The part of the 24702 story.

The moving average pipeline aggregation has been deprecated as of 6.4: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-movavg-aggregation.html

We need to replace it with the new Moving Function aggregation instead.

The changes replace Moving Average Aggregation by the Moving Function Aggregation

A previous view:

image

A following view:

image

Previous params:

                "the_movavg": {
                    "moving_avg":{
                        "buckets_path": "the_sum",
                        "window" : 30,
                        "model" : "holt_winters",
                        "settings" : {
                            "type" : "add",
                            "alpha" : 0.5,
                            "beta" : 0.5,
                            "gamma" : 0.5,
                            "period" : 7
                        }
                    }
                }

Following params:

                "the_movavg": {
                    "moving_fn": {
                        "buckets_path": "the_sum",
                        "window": 10,
                        "script": "if (values.length > 5*2) {MovingFunctions.holtWinters(values, 0.3, 0.1, 0.1, 5, false)}"
                    }
                }

Following differences for existing visualizations

Settings for Exponentially weighted, Holt-Linear, Holt-Winters models are partially affected. It means that alpha, beta, gamma, period have been reseted to default values.

// Default values
metric.alpha = 0;
metric.beta = 0;
metric.gamma = 0;
metric.period = 1;

Checklist

@gospodarsky gospodarsky added the WIP Work in progress label May 16, 2019
@gospodarsky gospodarsky requested a review from a team May 16, 2019 11:06
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@gospodarsky gospodarsky changed the title WIP: Replace deprecated moving_avg by moving_fn aggregation Replace deprecated moving_avg by moving_fn aggregation May 17, 2019
@gospodarsky gospodarsky requested a review from alexwizp May 17, 2019 14:31
@gospodarsky gospodarsky added Feature:TSVB TSVB (Time Series Visual Builder) and removed WIP Work in progress labels May 17, 2019
@gospodarsky gospodarsky changed the title Replace deprecated moving_avg by moving_fn aggregation [TSVB] Replace deprecated moving_avg by moving_fn aggregation May 17, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@alexwizp alexwizp left a comment

Choose a reason for hiding this comment

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

Please review comments

@elasticmachine
Copy link
Contributor

💔 Build Failed

@TinaHeiligers TinaHeiligers removed their request for review June 11, 2019 14:13
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@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.

One last minor thing to change and it's good to merge

src/legacy/core_plugins/kibana/migrations.js Outdated Show resolved Hide resolved
@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.

Code LGTM, tested locally!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@gospodarsky gospodarsky merged commit b6f472a into elastic:master Jun 19, 2019
gospodarsky added a commit that referenced this pull request Jun 20, 2019
#39275)

* Take model options away in a separate file

* Connect user scripting to models

* Add inputs to the panel for managing alpha, beta, gamma params

* Cover model types and scripts by tests

* Change default export of the bucket transform to the permanent one and write tests for moving_average

* Add a migration script from mov_avg to mov_fn

* Remove redundant translations

* Remove old tests

* Fix issues of PR

* Revert yarn.lock

* Fix issues regarding localization

* Remove extra license

* Remove redundant translations

* Move the replaceMovAvgToMovFn hook to 7.3.0

* Fix reviews

* Add a migration test

* Set proper default values and turn hint on for holt-winter only

* Format touched files by Prettier

* Import settings from moving_avg

* Wrap changes to the try/catch statement and log exceptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:TSVB TSVB (Time Series Visual Builder) release_note:breaking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TSVB] Replace deprecated moving_avg by moving_fn aggregation
8 participants