metrics for cache size / prune pauses
@jsternberg is already working on this.
Since Dec 5, 2023.
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Description
Why
We've seen issues where buildkit will sometimes pause for a long time while the cache manager is doing a prune().
It's fairly straightforward to reproduce this in isolation. A test that creates 1,000 cache entries then garbage collects them will hold the cache lock for about ~15s on my machine. But we don't have good visibility into how frequent these pauses are in a live system.
Feature request
Can we add a prometheus handler that exposes some metrics about cache / prune behavior?
A good place to start would be to take some inspiration from the pause metrics that Go itself uses for its GC (PauseTotalNs and PauseNs in https://pkg.go.dev/runtime#MemStats)
- A Gauge metric that tracks how many cache records are currently tracked by the CacheManager
- A Counter metric that tracks how much time, cumulatively, have been spent prune()
- A Histogram metric that tracks how long a single prune() takes (maybe 0.1s, 1s, 10s, 100s+)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.