instead. Since cache was separated from core this is no longer necessary@NonNullApi
@NonNullFields
@Deprecated
public class MicronautCaffeineCacheMetrics
extends io.micrometer.core.instrument.binder.cache.CacheMeterBinder
Note that `recordStats()` is required to gather non-zero statistics:
Cache<String, String> cache = Caffeine.newBuilder().recordStats().build();
CaffeineCacheMetrics.monitor(registry, cache, "mycache", "region", "test");
NOTE: This is a fork of https://github.com/micrometer-metrics/micrometer/blob/master/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java The fork is needed because Micronaut repackages caffeine under a different package.
| Constructor and Description |
|---|
MicronautCaffeineCacheMetrics(io.micronaut.caffeine.cache.Cache<?,?> cache,
java.lang.String cacheName,
java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
Deprecated.
Creates a new
MicronautCaffeineCacheMetrics instance. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
bindImplementationSpecificMetrics(io.micrometer.core.instrument.MeterRegistry registry)
Deprecated.
|
protected java.lang.Long |
evictionCount()
Deprecated.
|
protected long |
hitCount()
Deprecated.
|
protected java.lang.Long |
missCount()
Deprecated.
|
static <C extends io.micronaut.caffeine.cache.AsyncLoadingCache> |
monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
Deprecated.
Record metrics on a Caffeine cache.
|
static <C extends io.micronaut.caffeine.cache.Cache> |
monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
Deprecated.
Record metrics on a Caffeine cache.
|
static <C extends io.micronaut.caffeine.cache.AsyncLoadingCache> |
monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.String... tags)
Deprecated.
Record metrics on a Caffeine cache.
|
static <C extends io.micronaut.caffeine.cache.Cache> |
monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.String... tags)
Deprecated.
Record metrics on a Caffeine cache.
|
protected long |
putCount()
Deprecated.
|
protected java.lang.Long |
size()
Deprecated.
|
public MicronautCaffeineCacheMetrics(io.micronaut.caffeine.cache.Cache<?,?> cache,
java.lang.String cacheName,
java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
MicronautCaffeineCacheMetrics instance.cache - The cache to be instrumented. You must call Caffeine prior to building the cache
for metrics to be recorded.cacheName - Will be used to tag metrics with "cache".tags - tags to apply to all recorded metrics.public static <C extends io.micronaut.caffeine.cache.Cache> C monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.String... tags)
Caffeine.recordStats() prior to building the cache
for metrics to be recorded.C - The cache type.registry - The registry to bind metrics to.cache - The cache to instrument.cacheName - Will be used to tag metrics with "cache".tags - Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.public static <C extends io.micronaut.caffeine.cache.Cache> C monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
Caffeine.recordStats() prior to building the cache
for metrics to be recorded.C - The cache type.registry - The registry to bind metrics to.cache - The cache to instrument.cacheName - Will be used to tag metrics with "cache".tags - Tags to apply to all recorded metrics.CacheStatspublic static <C extends io.micronaut.caffeine.cache.AsyncLoadingCache> C monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.String... tags)
Caffeine.recordStats() prior to building the cache
for metrics to be recorded.C - The cache type.registry - The registry to bind metrics to.cache - The cache to instrument.cacheName - Will be used to tag metrics with "cache".tags - Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.public static <C extends io.micronaut.caffeine.cache.AsyncLoadingCache> C monitor(io.micrometer.core.instrument.MeterRegistry registry,
C cache,
java.lang.String cacheName,
java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
Caffeine.recordStats() prior to building the cache
for metrics to be recorded.C - The cache type.registry - The registry to bind metrics to.cache - The cache to instrument.cacheName - Will be used to tag metrics with "cache".tags - Tags to apply to all recorded metrics.CacheStatsprotected java.lang.Long size()
size in class io.micrometer.core.instrument.binder.cache.CacheMeterBinderprotected long hitCount()
hitCount in class io.micrometer.core.instrument.binder.cache.CacheMeterBinderprotected java.lang.Long missCount()
missCount in class io.micrometer.core.instrument.binder.cache.CacheMeterBinderprotected java.lang.Long evictionCount()
evictionCount in class io.micrometer.core.instrument.binder.cache.CacheMeterBinderprotected long putCount()
putCount in class io.micrometer.core.instrument.binder.cache.CacheMeterBinderprotected void bindImplementationSpecificMetrics(io.micrometer.core.instrument.MeterRegistry registry)
bindImplementationSpecificMetrics in class io.micrometer.core.instrument.binder.cache.CacheMeterBinder