The metrics-caffeine
module provides MetricsStatsCounter
, a metrics listener for
Caffeine caches:
LoadingCache<Integer, Integer> cache = Caffeine.newBuilder()
.recordStats(() -> new MetricsStatsCounter(registry, "cache"))
.build(key -> key);
The listener publishes these metrics:
|
Number of times a requested item was found in the cache. |
|
Number of times a requested item was not found in the cache. |
|
Timer for successful loads into cache. |
|
Timer for failed loads into cache. |
|
Histogram of eviction weights . |
|
Total weight of evicted entries. |
|
Histogram of eviction weights for each RemovalCause |