[Security Solution][Telemetry] Paginate ES queries#177263
Merged
szaffarano merged 29 commits intomainfrom Apr 4, 2024
Merged
Conversation
Contributor
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
donaherc
approved these changes
Mar 20, 2024
Contributor
donaherc
left a comment
There was a problem hiding this comment.
Generally LGTM, had a couple questions.
x-pack/plugins/security_solution/server/integration_tests/__mocks__/endpoint-metadata.json
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/integration_tests/lib/helpers.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/integration_tests/receiver.test.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/integration_tests/receiver.test.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/integration_tests/telemetry.test.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/telemetry/async_sender.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/telemetry/tasks/prebuilt_rule_alerts.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/telemetry/tasks/prebuilt_rule_alerts.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/telemetry/tasks/prebuilt_rule_alerts.ts
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
dhurley14
approved these changes
Apr 3, 2024
3 tasks
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Jul 12, 2024
…alerts (elastic#187859) ## Summary elastic#177263 changed the way `telemetry-prebuilt-rule-alerts` get data from elastic, but it changed the index used to run the queries. This PR fixes it using the proper index. (cherry picked from commit a120c51)
kibanamachine
added a commit
that referenced
this pull request
Jul 12, 2024
…uiltin alerts (#187859) (#188217) # Backport This will backport the following commits from `main` to `8.15`: - [[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)](#187859) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sebastián Zaffarano","email":"sebastian.zaffarano@elastic.co"},"sourceCommit":{"committedDate":"2024-07-12T13:17:43Z","message":"[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)\n\n## Summary\r\n\r\nhttps://github.com//pull/177263 changed the way\r\n`telemetry-prebuilt-rule-alerts` get data from elastic, but it changed\r\nthe index used to run the queries. This PR fixes it using the proper\r\nindex.","sha":"a120c510b9738aab0fb5f9296515a82f6f0792a6","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","v8.14.0","v8.15.0","v8.16.0"],"title":"[Telemetry][Security Solution] Use the proper index to query builtin alerts","number":187859,"url":"https://github.com/elastic/kibana/pull/187859","mergeCommit":{"message":"[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)\n\n## Summary\r\n\r\nhttps://github.com//pull/177263 changed the way\r\n`telemetry-prebuilt-rule-alerts` get data from elastic, but it changed\r\nthe index used to run the queries. This PR fixes it using the proper\r\nindex.","sha":"a120c510b9738aab0fb5f9296515a82f6f0792a6"}},"sourceBranch":"main","suggestedTargetBranches":["8.14","8.15"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187859","number":187859,"mergeCommit":{"message":"[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)\n\n## Summary\r\n\r\nhttps://github.com//pull/177263 changed the way\r\n`telemetry-prebuilt-rule-alerts` get data from elastic, but it changed\r\nthe index used to run the queries. This PR fixes it using the proper\r\nindex.","sha":"a120c510b9738aab0fb5f9296515a82f6f0792a6"}}]}] BACKPORT--> Co-authored-by: Sebastián Zaffarano <sebastian.zaffarano@elastic.co>
szaffarano
added a commit
that referenced
this pull request
Jul 15, 2024
…uiltin alerts (#187859) (#188235) # Backport This will backport the following commits from `main` to `8.14`: - [[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)](#187859) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sebastián Zaffarano","email":"sebastian.zaffarano@elastic.co"},"sourceCommit":{"committedDate":"2024-07-12T13:17:43Z","message":"[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)\n\n## Summary\r\n\r\nhttps://github.com//pull/177263 changed the way\r\n`telemetry-prebuilt-rule-alerts` get data from elastic, but it changed\r\nthe index used to run the queries. This PR fixes it using the proper\r\nindex.","sha":"a120c510b9738aab0fb5f9296515a82f6f0792a6","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","v8.14.0","v8.15.0","v8.16.0"],"title":"[Telemetry][Security Solution] Use the proper index to query builtin alerts","number":187859,"url":"https://github.com/elastic/kibana/pull/187859","mergeCommit":{"message":"[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)\n\n## Summary\r\n\r\nhttps://github.com//pull/177263 changed the way\r\n`telemetry-prebuilt-rule-alerts` get data from elastic, but it changed\r\nthe index used to run the queries. This PR fixes it using the proper\r\nindex.","sha":"a120c510b9738aab0fb5f9296515a82f6f0792a6"}},"sourceBranch":"main","suggestedTargetBranches":["8.14","8.15"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187859","number":187859,"mergeCommit":{"message":"[Telemetry][Security Solution] Use the proper index to query builtin alerts (#187859)\n\n## Summary\r\n\r\nhttps://github.com//pull/177263 changed the way\r\n`telemetry-prebuilt-rule-alerts` get data from elastic, but it changed\r\nthe index used to run the queries. This PR fixes it using the proper\r\nindex.","sha":"a120c510b9738aab0fb5f9296515a82f6f0792a6"}}]}] BACKPORT--> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Paginate ES queries
This PR adds the
ITelemetryReceiver#paginatemethod to execute Elasticsearch queries using aPITto paginate the responses. The number of documents per page is calculated using a sample set ofITelemetryReceiver#numDocsToSampledocuments for the given query to get an estimated average, and finally,ITelemetryReceiver#maxPageSizeBytesis divided by this average value.It's possible to configure the behavior with the following parameters:
ITelemetryReceiver#numDocsToSample: Defaults to 10 documents.ITelemetryReceiver#maxPageSizeBytes: Defaults tomin("2% of host's total memory", 80MiB).Endpoint Meta Task
One of the heaviest ES queries this task executes pulls a whole endpoint metrics document per agent. Since some clusters may (literally) have thousands of agents, it means the query response could potentially be expensive. Improvements:
WIP
numDocsToSampleandmaxPageSizeBytesas part of thetelemetry-buffer-and-batch-sizes-v1artifact to allow dynamics updates.ITelemetryReceiver#paginateacross the telemetry tasks.Checklist
Delete any items that are not applicable to this PR.
For maintainers