Skip to content

[Security Solution][Sourcerer] Replace unnecessary useDataViewSpec calls#224831

Merged
lgestc merged 8 commits intoelastic:mainfrom
lgestc:revisit_to_spec_call_sites
Jul 2, 2025
Merged

[Security Solution][Sourcerer] Replace unnecessary useDataViewSpec calls#224831
lgestc merged 8 commits intoelastic:mainfrom
lgestc:revisit_to_spec_call_sites

Conversation

@lgestc
Copy link
Contributor

@lgestc lgestc commented Jun 23, 2025

Summary

As useDataViewSpec uses are expensive (due to toSpec method in the data view implementation), this PR
adds in an optional switch to the hook and actually replaces it where we only need the data view id and not the full spec.

Testing

Set the FF,

xpack.securitySolution.enableExperimental: ['newDataViewPickerEnabled']

verify that the app still works correctly (timelines)

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

@lgestc lgestc added the release_note:skip Skip the PR/issue when compiling release notes label Jun 23, 2025
@lgestc lgestc requested a review from a team as a code owner June 23, 2025 10:27
@lgestc lgestc added the Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team label Jun 23, 2025
@lgestc lgestc requested a review from a team as a code owner June 23, 2025 10:27
@lgestc lgestc added backport:version Backport to applied version labels 9.1 candidate v9.1.0 v8.19.0 labels Jun 23, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

@PhilippeOberti
Copy link
Contributor

Maybe a dumb question, but would this work still be necessary if this other PR gets merged?

@PhilippeOberti
Copy link
Contributor

Maybe a dumb question, but would this work still be necessary if this other PR gets merged?

I think while that linked PR might help, I see now that the changes in this PR are still valuable. Please ignore my previous comment :)

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a non-blocker comment, otherwise LGTM!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

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 +80.0B

History

cc @michaelolo24

@lgestc lgestc added v9.2.0 and removed v9.1.0 labels Jul 2, 2025
@lgestc lgestc merged commit 711ab70 into elastic:main Jul 2, 2025
13 checks passed
@lgestc lgestc deleted the revisit_to_spec_call_sites branch July 2, 2025 12:14
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/16024814601

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 224831

Questions ?

Please refer to the Backport tool documentation

@lgestc lgestc added the v9.1.0 label Jul 2, 2025
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1

https://github.com/elastic/kibana/actions/runs/16024997022

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 2, 2025
…lls (elastic#224831)

## Summary

As useDataViewSpec uses are expensive (due to toSpec method in the data
view implementation), this PR
adds in an optional switch to the hook and actually replaces it where we
only need the data view id and not the full spec.

### Testing

Set the FF,

```
xpack.securitySolution.enableExperimental: ['newDataViewPickerEnabled']
```

verify that the app still works correctly (timelines)

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 711ab70)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.19 Backport failed because of merge conflicts
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 224831

Questions ?

Please refer to the Backport tool documentation

lgestc added a commit to lgestc/kibana that referenced this pull request Jul 2, 2025
…lls (elastic#224831)

## Summary

As useDataViewSpec uses are expensive (due to toSpec method in the data
view implementation), this PR
adds in an optional switch to the hook and actually replaces it where we
only need the data view id and not the full spec.

### Testing

Set the FF,

```
xpack.securitySolution.enableExperimental: ['newDataViewPickerEnabled']
```

verify that the app still works correctly (timelines)

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 711ab70)
@lgestc
Copy link
Contributor Author

lgestc commented Jul 2, 2025

💚 All backports created successfully

Status Branch Result
9.1
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

lgestc added a commit that referenced this pull request Jul 2, 2025
…Spec calls (#224831) (#226186)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution][Sourcerer] Replace unnecessary useDataViewSpec
calls (#224831)](#224831)

<!--- Backport version: 10.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Luke
Gmys","email":"11671118+lgestc@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-02T12:14:35Z","message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","backport:version","9.1
candidate","v9.1.0","v8.19.0","v9.2.0"],"title":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec
calls","number":224831,"url":"https://github.com/elastic/kibana/pull/224831","mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/226183","number":226183,"state":"OPEN"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224831","number":224831,"mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3"}}]}]
BACKPORT-->
lgestc added a commit that referenced this pull request Jul 2, 2025
…pec calls (#224831) (#226184)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution][Sourcerer] Replace unnecessary useDataViewSpec
calls (#224831)](#224831)

<!--- Backport version: 10.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Luke
Gmys","email":"11671118+lgestc@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-02T12:14:35Z","message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","backport:version","9.1
candidate","v9.1.0","v8.19.0","v9.2.0"],"title":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec
calls","number":224831,"url":"https://github.com/elastic/kibana/pull/224831","mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/226183","number":226183,"state":"OPEN"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224831","number":224831,"mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3"}}]}]
BACKPORT-->
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 3, 2025
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @michaelolo24

2 similar comments
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @michaelolo24

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @michaelolo24

@michaelolo24 michaelolo24 assigned lgestc and unassigned michaelolo24 Jul 7, 2025
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @lgestc

3 similar comments
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @lgestc

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @lgestc

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @lgestc

@lgestc lgestc added v9.1.0 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. v9.1.0 labels Jul 14, 2025
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 15, 2025
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @lgestc

kibanamachine added a commit that referenced this pull request Jul 15, 2025
…pec calls (#224831) (#226183)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution][Sourcerer] Replace unnecessary useDataViewSpec
calls (#224831)](#224831)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Luke
Gmys","email":"11671118+lgestc@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-02T12:14:35Z","message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","backport:version","9.1
candidate","v9.1.0","v8.19.0","v9.2.0"],"title":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec
calls","number":224831,"url":"https://github.com/elastic/kibana/pull/224831","mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224831","number":224831,"mergeCommit":{"message":"[Security
Solution][Sourcerer] Replace unnecessary useDataViewSpec calls
(#224831)\n\n## Summary\n\nAs useDataViewSpec uses are expensive (due to
toSpec method in the data\nview implementation), this PR\nadds in an
optional switch to the hook and actually replaces it where we\nonly need
the data view id and not the full spec.\n\n### Testing\n\nSet the
FF,\n\n```\nxpack.securitySolution.enableExperimental:
['newDataViewPickerEnabled']\n```\n\nverify that the app still works
correctly (timelines)\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"711ab70b3770addcba8fa66b28af65ceda11e5e3"}}]}]
BACKPORT-->

---------

Co-authored-by: Luke Gmys <11671118+lgestc@users.noreply.github.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 15, 2025
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
…lls (elastic#224831)

## Summary

As useDataViewSpec uses are expensive (due to toSpec method in the data
view implementation), this PR
adds in an optional switch to the hook and actually replaces it where we
only need the data view id and not the full spec.

### Testing

Set the FF,

```
xpack.securitySolution.enableExperimental: ['newDataViewPickerEnabled']
```

verify that the app still works correctly (timelines)

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

9.1 candidate backport:version Backport to applied version labels 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 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants