@NonNullApi @NonNullFields public abstract class CacheMeterBinder extends java.lang.Object implements MeterBinder
Having this common base set of metrics ensures that you can reason about basic cache performance in a dimensional slice that spans different cache implementations in your application.
| Constructor and Description |
|---|
CacheMeterBinder(java.lang.Object cache,
java.lang.String cacheName,
java.lang.Iterable<Tag> tags) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
bindImplementationSpecificMetrics(MeterRegistry registry)
Bind detailed metrics that are particular to the cache implementation, e.g.
|
void |
bindTo(MeterRegistry registry) |
protected abstract java.lang.Long |
evictionCount() |
protected java.lang.Iterable<Tag> |
getTagsWithCacheName() |
protected abstract long |
hitCount() |
protected abstract long |
missCount() |
protected abstract long |
putCount()
The put mechanism is unimportant - this count applies to entries added to the cache according to a pre-defined
load function such as exists in Guava/Caffeine caches as well as manual puts.
|
protected abstract java.lang.Long |
size()
MOST cache implementations provide a means of retrieving the number of entries.
|
public CacheMeterBinder(java.lang.Object cache,
java.lang.String cacheName,
java.lang.Iterable<Tag> tags)
public final void bindTo(MeterRegistry registry)
bindTo in interface MeterBinder@Nullable protected abstract java.lang.Long size()
null if the cache implementation does not provide a way to track cache size.protected abstract long hitCount()
protected abstract long missCount()
@Nullable protected abstract java.lang.Long evictionCount()
null if the cache implementation does not support eviction, or does not provide a way to track
the eviction count.protected abstract long putCount()
protected abstract void bindImplementationSpecificMetrics(MeterRegistry registry)
registry - The registry to bind metrics to.protected java.lang.Iterable<Tag> getTagsWithCacheName()