@NonNullApi @NonNullFields public abstract class CacheMeterBinder extends 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(Object cache,
String cacheName,
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. load duration for
Caffeine caches, heap and disk size for EhCache caches.
|
void |
bindTo(MeterRegistry registry) |
protected abstract Long |
evictionCount() |
protected 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 Long |
size()
MOST cache implementations provide a means of retrieving the number of entries.
|
public final void bindTo(MeterRegistry registry)
bindTo in interface MeterBinder@Nullable protected abstract Long size()
null if the cache implementation does not provide a way to track cache size.protected abstract long hitCount()
@Nullable protected abstract Long missCount()
null if the cache implementation does not provide a way to track miss count, especially in distributed
caches.@Nullable protected abstract 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.Copyright © 2020 LeanCloud. All rights reserved.