Skip to content

Comments

[8.19] [Investigations][DataViews] - Remove non-performant toSpec usage (#225726)#228346

Merged
michaelolo24 merged 5 commits intoelastic:8.19from
michaelolo24:backport/8.19/pr-225726
Jul 17, 2025
Merged

[8.19] [Investigations][DataViews] - Remove non-performant toSpec usage (#225726)#228346
michaelolo24 merged 5 commits intoelastic:8.19from
michaelolo24:backport/8.19/pr-225726

Conversation

@michaelolo24
Copy link
Contributor

Backport

This will backport the following commits from main to 8.19:

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/attack_discovery/pages/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_table/additional_toolbar_controls.tsx
#	x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_table/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/detections/pages/alerts/detection_engine.tsx
#	x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/risk_score_management/risk_score_preview_section.tsx
#	x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/top_risk_score_contributors_alerts/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/entity_analytics/pages/entity_analytics_privileged_user_monitoring_page.tsx
#	x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/details/index.tsx
#	x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/hosts.tsx
#	x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/network.tsx
#	x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/details/index.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:49
@dplumlee dplumlee disabled auto-merge July 17, 2025 00:23
@michaelolo24 michaelolo24 enabled auto-merge (squash) July 17, 2025 02:36
@michaelolo24 michaelolo24 merged commit 5e6b36c into elastic:8.19 Jul 17, 2025
8 checks passed
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.

4 participants