Package org.cache2k.extra.micrometer
Class Cache2kCacheMetrics
- java.lang.Object
- 
- io.micrometer.core.instrument.binder.cache.CacheMeterBinder
- 
- org.cache2k.extra.micrometer.Cache2kCacheMetrics
 
 
- 
- All Implemented Interfaces:
- io.micrometer.core.instrument.binder.MeterBinder
 
 public class Cache2kCacheMetrics extends io.micrometer.core.instrument.binder.cache.CacheMeterBinderMicrometer support for cache2k. Metrics will be bound automatically upon cache creation if enabled by the configuration. Alternatively, metrics can be bound to a registry programmatically viamonitor(MeterRegistry, Cache, String...).- Author:
- Jens Wilke
 
- 
- 
Constructor SummaryConstructors Constructor Description Cache2kCacheMetrics(org.cache2k.Cache<?,?> cache, Iterable<io.micrometer.core.instrument.Tag> tags)Creates a newCache2kCacheMetricsinstance.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbindImplementationSpecificMetrics(io.micrometer.core.instrument.MeterRegistry registry)Returns additional metrics similar to Caffeine and Guava.protected LongevictionCount()Sum up everything which removes an entry no matter the cause.protected longhitCount()protected LongmissCount()static <C extends org.cache2k.Cache>
 Cmonitor(io.micrometer.core.instrument.MeterRegistry registry, C cache, Iterable<io.micrometer.core.instrument.Tag> tags)Record metrics for a cache2k cache.static <C extends org.cache2k.Cache>
 Cmonitor(io.micrometer.core.instrument.MeterRegistry registry, C cache, String... tags)Record metrics for a cache2k cache.protected longputCount()protected Longsize()
 
- 
- 
- 
Constructor Detail- 
Cache2kCacheMetricspublic Cache2kCacheMetrics(org.cache2k.Cache<?,?> cache, Iterable<io.micrometer.core.instrument.Tag> tags)Creates a newCache2kCacheMetricsinstance.- Parameters:
- cache- The cache to be instrumented.
- tags- tags to apply to all recorded metrics.
 
 
- 
 - 
Method Detail- 
monitorpublic static <C extends org.cache2k.Cache> C monitor(io.micrometer.core.instrument.MeterRegistry registry, C cache, String... tags)Record metrics for a cache2k cache.- Type Parameters:
- C- The cache type.
- Parameters:
- registry- The registry to bind metrics to.
- cache- The cache to instrument.
- tags- Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.
- Returns:
- the cache as passed in.
 
 - 
monitorpublic static <C extends org.cache2k.Cache> C monitor(io.micrometer.core.instrument.MeterRegistry registry, C cache, Iterable<io.micrometer.core.instrument.Tag> tags)Record metrics for a cache2k cache.- Type Parameters:
- C- The cache type.
- Parameters:
- registry- The registry to bind metrics to.
- cache- The cache to instrument.
- tags- Tags to apply to all recorded metrics.
- Returns:
- the cache as passed in.
 
 - 
sizeprotected Long size() - Specified by:
- sizein class- io.micrometer.core.instrument.binder.cache.CacheMeterBinder
 
 - 
hitCountprotected long hitCount() - Specified by:
- hitCountin class- io.micrometer.core.instrument.binder.cache.CacheMeterBinder
 
 - 
missCountprotected Long missCount() - Specified by:
- missCountin class- io.micrometer.core.instrument.binder.cache.CacheMeterBinder
 
 - 
evictionCountprotected Long evictionCount() Sum up everything which removes an entry no matter the cause. This is probably most similar to the behavior of other caches.TODO: have separate metric for expired entries - Specified by:
- evictionCountin class- io.micrometer.core.instrument.binder.cache.CacheMeterBinder
 
 - 
putCountprotected long putCount() - Specified by:
- putCountin class- io.micrometer.core.instrument.binder.cache.CacheMeterBinder
 
 - 
bindImplementationSpecificMetricsprotected void bindImplementationSpecificMetrics(io.micrometer.core.instrument.MeterRegistry registry) Returns additional metrics similar to Caffeine and Guava.TODO: loads/refresh, evicted/expired - Specified by:
- bindImplementationSpecificMetricsin class- io.micrometer.core.instrument.binder.cache.CacheMeterBinder
 
 
- 
 
-