Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security] [AI assistant] setup/cleanup indices for evaluations #217078

Merged
merged 11 commits into from
Apr 7, 2025

Conversation

KDKHD
Copy link
Member

@KDKHD KDKHD commented Apr 3, 2025

Summary

Summarize your PR. If it involves visual changes include a screenshot or gif.

Setup indices and datastreams for evaluations. This will be used for ESQL evals and can be extended to setup other indices for other graphs.

How to test:

  1. Enable the evaluations feature flag in kibana.dev.yml
xpack.securitySolution.enableExperimental: ['assistantModelEvaluation']
  1. Launch Kibana
  2. Go to evaluations http://localhost:5601/app/management/kibana/securityAiAssistantManagement?tab=evaluation
  3. Start evaluations for the default assistant graph
image
  1. Go to discover -> create a dataview
  2. Search for *evaluations* and check there are datastreams and indices
image 8. These indices and datastreams are not cleaned up after the evaluation finishes. However, they are cleaned up when evaluations are re-run. To test this, run the evaluation again and see new datastreams and indices created. We can not do the cleanup after evaluations finish because evaluations happen asynchronously.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

Identify risks

Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
KDKHD Kenneth Kreindler
@KDKHD KDKHD changed the title setup/cleanup indices for evaluations [Security] [AI assistant] setup/cleanup indices for evaluations Apr 3, 2025
@KDKHD KDKHD added Team:Security Generative AI Security Generative AI backport:version Backport to applied version labels v9.1.0 v8.19.0 release_note:skip Skip the PR/issue when compiling release notes labels Apr 3, 2025
@KDKHD KDKHD marked this pull request as ready for review April 3, 2025 17:16
@KDKHD KDKHD requested a review from a team as a code owner April 3, 2025 17:17
KDKHD added 2 commits April 3, 2025 18:18

Verified

This commit was signed with the committer’s verified signature.
KDKHD Kenneth Kreindler

Verified

This commit was signed with the committer’s verified signature.
KDKHD Kenneth Kreindler
@KDKHD
Copy link
Member Author

KDKHD commented Apr 3, 2025

@elasticmachine merge upstream

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@KDKHD
Copy link
Member Author

KDKHD commented Apr 7, 2025

@elasticmachine merge upstream

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@KDKHD KDKHD requested a review from patrykkopycinski April 7, 2025 08:36
Copy link
Contributor

@patrykkopycinski patrykkopycinski left a comment

Choose a reason for hiding this comment

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

LGTM

KDKHD and others added 3 commits April 7, 2025 09:43

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…tes/evaluate/post_evaluate.ts

Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…tes/evaluate/post_evaluate.ts

Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>

Verified

This commit was signed with the committer’s verified signature.
KDKHD Kenneth Kreindler
@KDKHD KDKHD enabled auto-merge (squash) April 7, 2025 08:54
kibanamachine and others added 3 commits April 7, 2025 09:17

Verified

This commit was signed with the committer’s verified signature.
KDKHD Kenneth Kreindler

Verified

This commit was signed with the committer’s verified signature.
KDKHD Kenneth Kreindler
@KDKHD KDKHD merged commit 54094bd into elastic:main Apr 7, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @patrykkopycinski

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 217078

Questions ?

Please refer to the Backport tool documentation

KDKHD added a commit to KDKHD/kibana that referenced this pull request Apr 7, 2025

Unverified

The email in this signature doesn’t match the committer email.
…tic#217078)

## Summary

Summarize your PR. If it involves visual changes include a screenshot or
gif.

Setup indices and datastreams for evaluations. This will be used for
ESQL evals and can be extended to setup other indices for other graphs.

How to test:

1. Enable the evaluations feature flag in kibana.dev.yml
```
xpack.securitySolution.enableExperimental: ['assistantModelEvaluation']
```
2. Launch Kibana
4. Go to evaluations
http://localhost:5601/app/management/kibana/securityAiAssistantManagement?tab=evaluation
5. Start evaluations for the default assistant graph
<img width="1840" alt="image"
src="https://github.com/user-attachments/assets/2974b34f-40a7-4300-8294-d25d4f72b27e"
/>

6. Go to discover -> create a dataview
7. Search for `*evaluations*` and check there are datastreams and
indices
<img width="1840" alt="image"
src="https://github.com/user-attachments/assets/b6e9e476-82de-4292-9757-487ac85d7fce"
/>
8. These indices and datastreams are not cleaned up after the evaluation
finishes. However, they are cleaned up when evaluations are re-run. To
test this, run the evaluation again and see new datastreams and indices
created. We can not do the cleanup after evaluations finish because
evaluations happen asynchronously.

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [X] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [X]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [X] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [X] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [X] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [X] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
(cherry picked from commit 54094bd)

# Conflicts:
#	x-pack/solutions/security/plugins/elastic_assistant/server/routes/evaluate/post_evaluate.ts
@KDKHD
Copy link
Member Author

KDKHD commented Apr 7, 2025

💚 All backports created successfully

Status Branch Result
8.x

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

Questions ?

Please refer to the Backport tool documentation

KDKHD added a commit that referenced this pull request Apr 7, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…#217078) (#217311)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security] [AI assistant] setup/cleanup indices for evaluations
(#217078)](#217078)

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

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

<!--BACKPORT [{"author":{"name":"Kenneth
Kreindler","email":"42113355+KDKHD@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-07T11:22:26Z","message":"[Security]
[AI assistant] setup/cleanup indices for evaluations (#217078)\n\n##
Summary\n\nSummarize your PR. If it involves visual changes include a
screenshot or\ngif.\n\nSetup indices and datastreams for evaluations.
This will be used for\nESQL evals and can be extended to setup other
indices for other graphs.\n\nHow to test:\n\n1. Enable the evaluations
feature flag in
kibana.dev.yml\n```\nxpack.securitySolution.enableExperimental:
['assistantModelEvaluation']\n```\n2. Launch Kibana\n4. Go to
evaluations\nhttp://localhost:5601/app/management/kibana/securityAiAssistantManagement?tab=evaluation\n5.
Start evaluations for the default assistant graph\n<img width=\"1840\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/2974b34f-40a7-4300-8294-d25d4f72b27e\"\n/>\n\n6.
Go to discover -> create a dataview\n7. Search for `*evaluations*` and
check there are datastreams and\nindices\n<img width=\"1840\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b6e9e476-82de-4292-9757-487ac85d7fce\"\n/>\n8.
These indices and datastreams are not cleaned up after the
evaluation\nfinishes. However, they are cleaned up when evaluations are
re-run. To\ntest this, run the evaluation again and see new datastreams
and indices\ncreated. We can not do the cleanup after evaluations finish
because\nevaluations happen asynchronously.\n\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [X] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[X]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\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\n- [X] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[X] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [X] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [X] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nDoes this PR introduce any risks? For example,
consider risks like hard\nto test bugs, performance regression,
potential of data loss.\n\nDescribe the risk, its severity, and
mitigation for each identified\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\n\n- [ ] [See some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>\nCo-authored-by: Patryk
Kopyciński
<contact@patrykkopycinski.com>","sha":"54094bdb966e612a7f68176c4696dd6d9de8ef21","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Security
Generative
AI","backport:version","v9.1.0","v8.19.0"],"title":"[Security] [AI
assistant] setup/cleanup indices for
evaluations","number":217078,"url":"https://github.com/elastic/kibana/pull/217078","mergeCommit":{"message":"[Security]
[AI assistant] setup/cleanup indices for evaluations (#217078)\n\n##
Summary\n\nSummarize your PR. If it involves visual changes include a
screenshot or\ngif.\n\nSetup indices and datastreams for evaluations.
This will be used for\nESQL evals and can be extended to setup other
indices for other graphs.\n\nHow to test:\n\n1. Enable the evaluations
feature flag in
kibana.dev.yml\n```\nxpack.securitySolution.enableExperimental:
['assistantModelEvaluation']\n```\n2. Launch Kibana\n4. Go to
evaluations\nhttp://localhost:5601/app/management/kibana/securityAiAssistantManagement?tab=evaluation\n5.
Start evaluations for the default assistant graph\n<img width=\"1840\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/2974b34f-40a7-4300-8294-d25d4f72b27e\"\n/>\n\n6.
Go to discover -> create a dataview\n7. Search for `*evaluations*` and
check there are datastreams and\nindices\n<img width=\"1840\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b6e9e476-82de-4292-9757-487ac85d7fce\"\n/>\n8.
These indices and datastreams are not cleaned up after the
evaluation\nfinishes. However, they are cleaned up when evaluations are
re-run. To\ntest this, run the evaluation again and see new datastreams
and indices\ncreated. We can not do the cleanup after evaluations finish
because\nevaluations happen asynchronously.\n\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [X] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[X]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\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\n- [X] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[X] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [X] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [X] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nDoes this PR introduce any risks? For example,
consider risks like hard\nto test bugs, performance regression,
potential of data loss.\n\nDescribe the risk, its severity, and
mitigation for each identified\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\n\n- [ ] [See some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>\nCo-authored-by: Patryk
Kopyciński
<contact@patrykkopycinski.com>","sha":"54094bdb966e612a7f68176c4696dd6d9de8ef21"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217078","number":217078,"mergeCommit":{"message":"[Security]
[AI assistant] setup/cleanup indices for evaluations (#217078)\n\n##
Summary\n\nSummarize your PR. If it involves visual changes include a
screenshot or\ngif.\n\nSetup indices and datastreams for evaluations.
This will be used for\nESQL evals and can be extended to setup other
indices for other graphs.\n\nHow to test:\n\n1. Enable the evaluations
feature flag in
kibana.dev.yml\n```\nxpack.securitySolution.enableExperimental:
['assistantModelEvaluation']\n```\n2. Launch Kibana\n4. Go to
evaluations\nhttp://localhost:5601/app/management/kibana/securityAiAssistantManagement?tab=evaluation\n5.
Start evaluations for the default assistant graph\n<img width=\"1840\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/2974b34f-40a7-4300-8294-d25d4f72b27e\"\n/>\n\n6.
Go to discover -> create a dataview\n7. Search for `*evaluations*` and
check there are datastreams and\nindices\n<img width=\"1840\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/b6e9e476-82de-4292-9757-487ac85d7fce\"\n/>\n8.
These indices and datastreams are not cleaned up after the
evaluation\nfinishes. However, they are cleaned up when evaluations are
re-run. To\ntest this, run the evaluation again and see new datastreams
and indices\ncreated. We can not do the cleanup after evaluations finish
because\nevaluations happen asynchronously.\n\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [X] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[X]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\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\n- [X] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[X] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [X] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [X] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nDoes this PR introduce any risks? For example,
consider risks like hard\nto test bugs, performance regression,
potential of data loss.\n\nDescribe the risk, its severity, and
mitigation for each identified\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\n\n- [ ] [See some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>\nCo-authored-by: Patryk
Kopyciński
<contact@patrykkopycinski.com>","sha":"54094bdb966e612a7f68176c4696dd6d9de8ef21"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
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 release_note:skip Skip the PR/issue when compiling release notes Team:Security Generative AI Security Generative AI v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants