Skip to content

[Lens as code] Add metric trend runtime datasource state hydration#258104

Closed
markov00 wants to merge 2 commits intoelastic:mainfrom
markov00:2026_03_17-runtime_state_hydration
Closed

[Lens as code] Add metric trend runtime datasource state hydration#258104
markov00 wants to merge 2 commits intoelastic:mainfrom
markov00:2026_03_17-runtime_state_hydration

Conversation

@markov00
Copy link
Copy Markdown
Contributor

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

@markov00 markov00 added bug Fixes for quality problems that affect the customer experience Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// release_note:skip Skip the PR/issue when compiling release notes Feature:Lens backport:skip This PR does not require backporting labels Mar 17, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Mar 17, 2026

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!

@markov00 markov00 force-pushed the 2026_03_17-runtime_state_hydration branch from 9837c2d to eebcb6f Compare March 17, 2026 17:04
@elasticmachine
Copy link
Copy Markdown
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

History

@markov00
Copy link
Copy Markdown
Contributor Author

replaced by #264777

@markov00 markov00 closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting bug Fixes for quality problems that affect the customer experience Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens as code] Metric trendline not visible

3 participants