Skip to content

[WIP] - Add dataview cache to toSpec call#223466

Closed
michaelolo24 wants to merge 1 commit intoelastic:mainfrom
michaelolo24:add-dataview-spec-cache
Closed

[WIP] - Add dataview cache to toSpec call#223466
michaelolo24 wants to merge 1 commit intoelastic:mainfrom
michaelolo24:add-dataview-spec-cache

Conversation

@michaelolo24
Copy link
Contributor

@michaelolo24 michaelolo24 commented Jun 11, 2025

Summary

This PR introduces a basic cache for the .toSpec() call of a DataView instance. The rationale behind this is due to the potential performance impact of these calls when fields are included. Often this isn't seen in local development, but when testing with enough fields (500K+), this can be significantly noticeable.

This is much older code, but in security we've worked around this by essentially caching the basic fields necessary for the spec here and then passing that around through the application here to be able to generate dataViews via new DataView(sourcererSpec). We're updating this logic to get the actual dataviews via dataViews.get and making use of dataView.toSpec to rely on the up to date fields from that call, rather than caching them separately in redux, Unfortunately this may introduce performance impacts due to the necessity for fields in many of our components and caching not being built in to the class.
We can keep our current redux pattern, but we would like to rely on the DataView service more rather than having workaround.

Prior art: https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-lens-embeddable-utils/attribute_builder/data_view_cache.ts

Similar approach here based on our dataView refactoring.

@elasticmachine
Copy link
Contributor

elasticmachine commented Jun 11, 2025

🤖 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!

@michaelolo24 michaelolo24 added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team backport:version Backport to applied version labels v9.1.0 v8.19.0 ci:cloud-deploy Create or update a Cloud deployment labels Jun 11, 2025
@kibanamachine
Copy link
Contributor

Project deployments require a Github label, please add one or more of ci:project-deploy-(elasticsearch|observability|security) and trigger the job through the checkbox again.

@michaelolo24 michaelolo24 force-pushed the add-dataview-spec-cache branch from e5bdfa4 to e81ab95 Compare June 19, 2025 01:53
@michaelolo24 michaelolo24 force-pushed the add-dataview-spec-cache branch from e81ab95 to 7fe47e5 Compare June 19, 2025 01:56
@kibanamachine
Copy link
Contributor

Cloud deployment initiated, see credentials at: https://buildkite.com/elastic/kibana-deploy-cloud-from-pr/builds/255

@michaelolo24
Copy link
Contributor Author

/ci

@elasticmachine
Copy link
Contributor

elasticmachine commented Jun 19, 2025

💔 Build Failed

Failed CI Steps

History

@michaelolo24
Copy link
Contributor Author

closing in favor of: #224767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels ci:cloud-deploy Create or update a Cloud deployment release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants