Skip to content

Comments

[9.1] [Investigations][DataViews] - Remove non-performant toSpec usage (#225726)#228342

Merged
michaelolo24 merged 1 commit intoelastic:9.1from
michaelolo24:backport/9.1/pr-225726
Jul 16, 2025
Merged

[9.1] [Investigations][DataViews] - Remove non-performant toSpec usage (#225726)#228342
michaelolo24 merged 1 commit intoelastic:9.1from
michaelolo24:backport/9.1/pr-225726

Conversation

@michaelolo24
Copy link
Contributor

Backport

This will backport the following commits from main to 9.1:

Questions ?

Please refer to the Backport tool documentation

…stic#225726)

## Summary

This PR looks to improve the performance of the application by using
`DataView` in place of `DataViewSpec`. The currently used `DataViewSpec`
turns out to not be performant at scale because it lacks caching, and
performs quite a few nested iterations in the
[DataView.toSpec](https://github.com/elastic/kibana/blob/27183690142a5590b4ad72d060c43cad869f3f3c/src/platform/plugins/shared/data_views/common/data_views/data_view.ts#L147)
call as seen
[here](https://github.com/elastic/kibana/blob/27183690142a5590b4ad72d060c43cad869f3f3c/src/platform/plugins/shared/data_views/common/data_views/abstract_data_views.ts#L391-L422),
[here](https://github.com/elastic/kibana/blob/27183690142a5590b4ad72d060c43cad869f3f3c/src/platform/plugins/shared/data_views/common/fields/field_list.ts#L157-L159),
and finally
[here](https://github.com/elastic/kibana/blob/27183690142a5590b4ad72d060c43cad869f3f3c/src/platform/plugins/shared/data_views/common/fields/data_view_field.ts#L438-L440).
While this may not be a significant issue at a few thousand fields, this
does not scale well as the number of fields reaches the tens/hundreds of
thousands.

This PR makes the change to rely on the DataView instance directly,
which is cached in memory. These performance impacts aren't seen
currently as the new framework is currently disabled behind the below
feature flag.

** Relevant configurations **
`xpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']`

---------

Co-authored-by: PhilippeOberti <philippe.oberti@elastic.co>
(cherry picked from commit 6294df6)

# Conflicts:
#	x-pack/solutions/security/plugins/security_solution/public/entity_analytics/pages/entity_analytics_privileged_user_monitoring_page.tsx
@michaelolo24 michaelolo24 added the backport This PR is a backport of another PR label Jul 16, 2025
@michaelolo24 michaelolo24 enabled auto-merge (squash) July 16, 2025 22:11
@michaelolo24 michaelolo24 merged commit 2dd8001 into elastic:9.1 Jul 16, 2025
16 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #54 / alerting api integration security and spaces enabled - Group 2 Connectors index action should execute successly when expected for with multiple bodies

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 9.8MB 9.8MB +243.0B
Unknown metric groups

References to deprecated APIs

id before after diff
securitySolution 348 356 +8

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

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants