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
Elasticsearch: Fix handling of inline scripts in different ES versions #34070
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Elfo404
force-pushed
the
gio/fix/es-script
branch
from
May 13, 2021 15:03
3e1bdb2
to
3c6d007
Compare
Elfo404
changed the title
Gio/fix/es script
Elasticsearch: Fix handling of inline scripts in different ES versions
May 13, 2021
Just wanted to say you're awesome. Thanks for the quick turnaround! |
aocenas
approved these changes
May 14, 2021
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.
Looks good 👍
mortenaa
pushed a commit
to mortenaa/grafana
that referenced
this pull request
May 25, 2021
grafana#34070) * Devenv: add block for es 5.0, provisioned datasource & dashboard * Trasnsform script property based on running ES version * Handle different scripts format in BE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/backend
area/frontend
datasource/Elasticsearch
old backport v8.0.x
Mark PR for automatic backport to v8.0.x
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Aggregations' Inline scripts prior to ES 5.6 had to be defined like (VERSION B)
in 5.6, the former was deprecated in favor of:
or, as a shorthand: (VERSION A)
In Grafana < 7.4 we were storing the query model like VERSION B, in >=7.4 like VERSION A.
This PR fixes 2 things:
Which issue(s) this PR fixes:
Fixes #34028
Closes #34030
Special notes for your reviewer:
I created a docker block in devenv for ES 5.0 and moved
elastic5
toelastic56
as it was using elasticsearch 5.6. I'm not able to start both at the same time as somehow when starting both one of the nodes elects itself as master and shuts down the other. I tried working around this by setting different configurations but none of them did the job.I also created a row in http://localhost:3000/d/fuFWehBmk/datasource-tests-elasticsearch-comparison (
Datasource tests -> Elasticsearch comparison
) that has queries using both the new and old script format.as mentioned above, running 2 ES version at the same time doesn't work ATM, the best way I can think of to test this is therefore running
make devenv sources=elastic5
, check that both series are being shown, thenmake devenv sources=elastic56
and repeat.Alerting as well works as expected with both formats and both ES version, testing is a bit more trickier as the datasource is templated, so make sure to pick the one you are testing against before testing the alerting rule:
->
Alerting tests:
ES 5.0
New Script format (VERSION A, Query A)
OLD Script format (VERSION A, Query B)
ES 5.6
New Script format (VERSION A, Query A)
Old Script format (VERSION B, Query B)
PS: Don't forget to run
./setup.sh
indevenv
to get updates to data sources and dashboard :)