-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security] [AI assistant] setup/cleanup indices for evaluations #217078
Conversation
@elasticmachine merge upstream |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
x-pack/solutions/security/plugins/elastic_assistant/server/routes/evaluate/post_evaluate.ts
Outdated
Show resolved
Hide resolved
x-pack/solutions/security/plugins/elastic_assistant/server/routes/evaluate/post_evaluate.ts
Outdated
Show resolved
Hide resolved
...routes/evaluate/prepare_indices_for_evaluations/graph_type/assistant/index_requests/index.ts
Outdated
Show resolved
Hide resolved
…tes/evaluate/post_evaluate.ts Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
…tes/evaluate/post_evaluate.ts Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
Starting backport for target branches: 8.x |
💚 Build Succeeded
Metrics [docs]
History
|
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
…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
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…#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>
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:
*evaluations*
and check there are datastreams and indicesChecklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breaking
label should be applied in these situations.release_note:*
label is applied per the guidelinesIdentify 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.