-
Notifications
You must be signed in to change notification settings - Fork 46
feat: disk cache #4033
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
base: main
Are you sure you want to change the base?
feat: disk cache #4033
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a disk-based cache option for the Prometheus exporter to reduce memory overhead in large deployments. The feature allows metrics to be staged on disk rather than stored in memory, with Prometheus reading directly from cached files during scrapes.
Key changes:
- Added
DiskCacheConfigto support configurable disk-based caching with a mandatorypathparameter - Implemented
diskCachetype that writes metrics to disk files and streams them during scrapes - Introduced
cacherinterface to abstract memory and disk cache implementations
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/conf/conf.go | Added DiskCacheConfig struct and DiskCache field to Exporter configuration |
| docs/prometheus-exporter.md | Added documentation for the new disk_cache configuration parameter with examples |
| cmd/exporters/prometheus/prometheus_test.go | Updated tests to work with the new cacher interface using type assertions |
| cmd/exporters/prometheus/prometheus.go | Integrated disk cache support with conditional cache creation and updated Export logic |
| cmd/exporters/prometheus/httpd.go | Modified HTTP handlers to support both memory and disk cache serving |
| cmd/exporters/prometheus/disk_cache.go | New file implementing disk-based cache with file I/O operations |
| cmd/exporters/prometheus/cacher.go | New file defining cache interfaces for memory and disk implementations |
| cmd/exporters/prometheus/cache.go | Updated memory cache to implement new cacher interface |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
024eb29 to
0d96360
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hardikl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Should we compare more object loaded vsim or actual cluster for better diff ?
In Memory Cache over time since start
Disk Cache over time since start