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

kibana_usage_collection: optimize SO PIT searches #168677

Merged

Conversation

pgayvallet
Copy link
Contributor

Summary

Properly loop though PIT search pages instead of fetching all documents at once

@pgayvallet pgayvallet added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Telemetry release_note:skip Skip the PR/issue when compiling release notes v8.12.0 labels Oct 12, 2023
@pgayvallet pgayvallet force-pushed the kbn-xxx-usage_collection_pit_optims branch from 47e34b8 to 13c6ac7 Compare October 13, 2023 08:18
@pgayvallet pgayvallet marked this pull request as ready for review October 13, 2023 12:32
@pgayvallet pgayvallet requested a review from a team as a code owner October 13, 2023 12:32
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the optimization improvement

Comment on lines +92 to +93
savedObjectsClient.bulkDelete(
usageDailyIdsToDelete.map((id) => ({ id, type: SAVED_OBJECTS_DAILY_TYPE }))
Copy link
Member

Choose a reason for hiding this comment

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

🧡

return accum;
}, {} as Record<string, number>);

const counts: Record<string, number> = {};
Copy link
Member

Choose a reason for hiding this comment

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

NIT: We may be able to convert this to an ES aggregation, so there's no need to loop through all documents.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I came to the same conclusion after I adapted the code. I wanted to try it, but in a follow-up (this one was initially supposed to be only for the usage collection calls)

@pgayvallet
Copy link
Contributor Author

@elasticmachine merge upstream

@pgayvallet pgayvallet enabled auto-merge (squash) October 15, 2023 09:38
@pgayvallet pgayvallet merged commit 0217724 into elastic:main Oct 15, 2023
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #23 / apis home apis sample data apis install in the other space dates should load elasticsearch index containing sample data with dates relative to current time

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Oct 15, 2023
dej611 pushed a commit to dej611/kibana that referenced this pull request Oct 17, 2023
## Summary

Properly loop though PIT search pages instead of fetching all documents
at once

---------

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Telemetry release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants