Feat/implement cache stats endpoint#1950
Open
gauravshinde1729 wants to merge 2 commits into
Open
Conversation
Signed-off-by: gauravshinde1729 <shindegauravpict@gmail.com>
Signed-off-by: gauravshinde1729 <shindegauravpict@gmail.com>
Member
|
I really like this! The only concern I have is, that currently we don't have a separate cache per Organisation. There is just a single global dependency proxy cache. We should either:
In the end, it would be great to have both. So for you to start straight away maybe you can work on creating separate sub folders for the cache directory for each Organisation. We have to watch out for cache poisoning. Maybe we can use the org id as folder name. What do you think? |
Contributor
Author
|
Sure Thanks @timbastin , That's a great idea ! |
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.
#1915
Adds a new admin endpoint to inspect on-disk consumption of the dependency and OCI proxy cache.
GET /api/v1/organizations/:organization/dependency-proxy/cache-stats/Gated to org admins (
managescope +ActionUpdateon the organization), matching the existing org-stats endpoint. Walks the configured cache directory once and returns aggregate storage usage — overall, per ecosystem (npm,go,pypi,oci), and an OCI manifest-vs-blob split.Companion files written by the proxy (
.sha256,.releasetime,.contenttype,.digest) count towardsizeBytesbut not towardentries, so the entry count reflects real cached payloads only. Ecosystems that have never been hit don't appear inbyEcosystem. A missing cache directory returns zeroed stats rather than an error.Example response:
{ "cacheDir": "/tmp/devguard-dependency-proxy-cache", "totalSizeBytes": 825215, "totalEntries": 4, "oldestEntry": "2026-05-10T10:02:44Z", "newestEntry": "2026-05-10T22:19:52Z", "byEcosystem": { "npm": { "sizeBytes": 801366, "entries": 1, "oldestEntry": "2026-05-10T22:09:26Z", "newestEntry": "2026-05-10T22:09:26Z" }, "oci": { "sizeBytes": 23849, "entries": 3, "oldestEntry": "2026-05-10T10:02:44Z", "newestEntry": "2026-05-10T22:19:52Z" } }, "ociBreakdown": { "manifests": { "sizeBytes": 23849, "entries": 3 }, "blobs": { "sizeBytes": 0, "entries": 0 } } }