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] Add cache-control headers to key /epm endpoints in Fleet API #130921

Merged
merged 9 commits into from
Apr 26, 2022

Conversation

kpollich
Copy link
Member

@kpollich kpollich commented Apr 25, 2022

Summary

Resolves #125794

Improve performance throughout the Integrations UI by caching key responses around integrations data:

  • GET /api/fleet/epm/categories - "Browse integrations" grid side panel
  • GET /api/fleet/epm/packages - "Browse integrations" grid data
    • Also supports an optional excludeInstallStatus parameter that allows us to opt-in to caching on the "Browse integrations" tab when we can afford to cache package list data
  • GET /api/fleet/epm/packages/<name>/<version>/<file path> - Allows for caching requests for assets like README.md files, etc

Each of these endpoints has a cache-control header w/ value max-age: 600 added, so they'll be cached for 10 minutes. Further improvements could be made in the future around more granular caching values for each endpoint, or investigating the usage of the stale-while-revalidate cache directive to avoid heavy un-cached requests once the cache is stale.

I've included some network tab screenshots and notes around each of these requests below:

View screenshots

image

image

image

image

@kpollich kpollich added release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team ci:deploy-cloud v8.3.0 labels Apr 25, 2022
@kpollich kpollich self-assigned this Apr 25, 2022
@kpollich kpollich requested a review from a team as a code owner April 25, 2022 18:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich
Copy link
Member Author

I'm going to swap the includeInstallStatus query string for an excludeInstallStatus query string because I think we have more cases where we want the install status included than we want it excluded.

@joshdover
Copy link
Contributor

I'm going to swap the includeInstallStatus query string for an excludeInstallStatus query string because I think we have more cases where we want the install status included than we want it excluded.

Makes sense to me. I think this would be a breaking change otherwise too, no?

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

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 1267 1268 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 693.3KB 693.4KB +24.0B
Unknown metric groups

API count

id before after diff
fleet 1384 1385 +1

History

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

cc @kpollich

Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

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

LGTM

@kpollich
Copy link
Member Author

I'm going to swap the includeInstallStatus query string for an excludeInstallStatus query string because I think we have more cases where we want the install status included than we want it excluded.

Makes sense to me. I think this would be a breaking change otherwise too, no?

Yep you are correct. Latest commit here has this change implemented and all is green, so I'm landing this.

@kpollich kpollich merged commit 5d85976 into elastic:main Apr 26, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 26, 2022
@kpollich kpollich deleted the 125794-cache-control-headers branch April 26, 2022 14:50
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
…API (elastic#130921)

* Add cache-control header to /categories endpoint

* Add cache-control header + includeInstallStatus parameter to /packages endpoint

* Add cache-control header parameter to filepath endpoint

* Fix installation status type

* Fix getLimitedPackages call

* Fix cypress tests

* Fix checks + integration test

* Swap includeInstallStatus -> excludeInstallStatus query parameter

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@tylersmalley tylersmalley added the ci:cloud-deploy Create or update a Cloud deployment label Aug 17, 2022
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 ci:cloud-deploy Create or update a Cloud deployment release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Use cache-control headers on EPM get routes
8 participants