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

[Fleet] Fetch only relevant assets for package policies operation #213267

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Mar 5, 2025

Summary

Related to #205332

That PR change the way we fetch assets, it now fetch only relevant assets for package policies operations instead of the whole assets maps (manifest and agents template).

Saved object change

To be able to filter assets we load I now store the path in package_assets array store on the package saved object

Benchmark

Upgrade dry run on 5 aws policies

Before
Screenshot 2025-03-05 at 11 34 41 AM
After
Screenshot 2025-03-05 at 11 30 27 AM

Upgrade 10 packages policies (without agent policy as there are need to improve the package policy too in a next PR)

Before
Screenshot 2025-03-05 at 1 05 35 PM

Kibana memory usage at the same time
Screenshot 2025-03-05 at 3 01 59 PM

After
Screenshot 2025-03-05 at 12 48 02 PM Screenshot 2025-03-05 at 2 53 19 PM

TODO

  • update e2e test with new path property on install

@nchaulet nchaulet self-assigned this Mar 5, 2025
@nchaulet nchaulet added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:Fleet Team label for Observability Data Collection Fleet team labels Mar 5, 2025
@@ -126,6 +126,8 @@ export type InstallablePackage = RegistryPackage | ArchivePackage;

export type AssetsMap = Map<string, Buffer | undefined>;

export type PackagePolicyAssetsMap = AssetsMap & { __brand: 'PackagePolicyAssetsMap' };
Copy link
Member Author

Choose a reason for hiding this comment

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

use type branding to make sure AssetsMap is not used as a PackagePolicyAssetsMap by error

@@ -17,12 +17,15 @@ const cacheStore = new AsyncLocalStorage<CacheSession>();

const PACKAGE_INFO_CACHE_SIZE = 20;
const PACKAGE_ASSETS_MAP_CACHE_SIZE = 1;
const AGENT_TEMPLATE_ASSETS_MAP_CACHE_SIZE = 5;
Copy link
Member Author

Choose a reason for hiding this comment

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

We can cache more than package assets map as it only contains agent template and manifest, and not all ES|kibana assets like PACKAGE_ASSETS_MAP_CACHE_SIZE

@nchaulet nchaulet force-pushed the feature-package-assets-map branch from 0a4948a to 615a7af Compare March 5, 2025 19:21
@nchaulet nchaulet force-pushed the feature-package-assets-map branch from 615a7af to 748a6e2 Compare March 5, 2025 20:17
@nchaulet nchaulet marked this pull request as ready for review March 5, 2025 21:19
@nchaulet nchaulet requested a review from a team as a code owner March 5, 2025 21:19
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elasticmachine
Copy link
Contributor

elasticmachine commented Mar 5, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #74 / EPM Endpoints installs and uninstalls all assets installs all assets when installing a package for the first time should have created the correct saved object
  • [job] [logs] FTR Configs #74 / EPM Endpoints installs and uninstalls all assets installs all assets when installing a package for the first time should have created the correct saved object
  • [job] [logs] Fleet Cypress Tests #1 / View agents list Agent status filter should filter on healthy and unhealthy
  • [job] [logs] Fleet Cypress Tests #1 / View agents list Bulk actions should allow to bulk upgrade agents and cancel that upgrade

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1336 1337 +1
Unknown metric groups

API count

id before after diff
fleet 1463 1464 +1

History

cc @nchaulet

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 release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants