Log a warning when instrumenting a cache that is not recording stats in CaffeineCacheMetrics by izeye · Pull Request #5402 · micrometer-metrics/micrometer (original) (raw)
This PR changes to log a warning when instrumenting a cache that is not recording statistics in the CaffeineCacheMetrics.
See gh-5066
izeye mentioned this pull request
The Guava cache also has the same concept, but it doesn't seem to have an API corresponding to Policy.isRecordingStats() from the Caffeine cache.
In addition to logging the warning, we can try not to register meters that depend on the Caffeine.recordStats() call at all instead of registering zero-valued meters.
In addition to logging the warning, we can try not to register meters that depend on the
Caffeine.recordStats()call at all instead of registering zero-valued meters.
That sounds like a good idea to me. It will be more clear we don't have metrics for those rather than saying the metrics for those are 0. Do you want to update this pull request with that or make a separate PR for it?
@shakuzen Thanks for the feedback!
Looking into its implementation details, it seems a bit tricky, so it would be better to be discussed in a separate issue. I can try another PR if it's proven to be okay in the issue.
izeye deleted the gh-gh-5066 branch
izeye mentioned this pull request
Looking into its implementation details, it seems a bit tricky, so it would be better to be discussed in a separate issue.
I created #5408.
izeye mentioned this pull request
3 tasks
The Guava cache also has the same concept, but it doesn't seem to have an API corresponding to
Policy.isRecordingStats()from the Caffeine cache.
I created google/guava#7381 to see if it could be improved.
This was referenced
Jun 3, 2026
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
[ Show hidden characters]({{ revealButtonHref }})