[Lens as code] Add metric trend runtime datasource state hydration#258104
Closed
markov00 wants to merge 2 commits intoelastic:mainfrom
Closed
[Lens as code] Add metric trend runtime datasource state hydration#258104markov00 wants to merge 2 commits intoelastic:mainfrom
markov00 wants to merge 2 commits intoelastic:mainfrom
Conversation
Contributor
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
1 task
9837c2d to
eebcb6f
Compare
Contributor
⏳ Build in-progress, with failures
Failed CI StepsHistory
|
Contributor
Author
|
replaced by #264777 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds a runtime hydration of the Metric datasource state for the trendline hidden layer.
This only works for DSL metric charts and is a particular chase that happen due to the API schema and transformation logic.
The trendline datasource layer and its columns are hydrated at runtime when the conditions are met using the current dataview and its timefield.
Fix #251620
Rationale
Instead of polluting the API schema and asking the user to specify a timefield for the trend line, we kept it simple for now: let's just specify that you are interested in a trend line and we will use the defaults coming from the current dataview selected (the same that is happening in the Lens editor).
This solves the possible problems a timefield could have caused in the API schema: the UI doesn't currently allow the user to select a different timefield for the trendline, and also prepare the code for a future fallback in case the timefield will land in the API and the timefield is not present in the dataview.
The current place where we are hydrating the state can also be used by all the other runtime migrations (that are actually doing a similar logic at runtime, not hydrating by migrating).