Class CacheMetricsRegistrar
- java.lang.Object
- org.springframework.boot.actuate.metrics.cache.CacheMetricsRegistrar
public class CacheMetricsRegistrar extends Object
Register supportedCache
to aMeterRegistry
.- Since:
- 2.0.0
Constructor Summary
Constructors Constructor Description CacheMetricsRegistrar(io.micrometer.core.instrument.MeterRegistry registry, Collection<CacheMeterBinderProvider<?>> binderProviders)
Creates a new registrar.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
bindCacheToRegistry(org.springframework.cache.Cache cache, io.micrometer.core.instrument.Tag... tags)
Attempt to bind the specifiedCache
to the registry.protected Iterable<io.micrometer.core.instrument.Tag>
getAdditionalTags(org.springframework.cache.Cache cache)
Return additionaltags
to be associated with the givenCache
.
Constructor Detail
CacheMetricsRegistrar
public CacheMetricsRegistrar(io.micrometer.core.instrument.MeterRegistry registry, Collection<CacheMeterBinderProvider<?>> binderProviders)
Creates a new registrar.- Parameters:
registry
- theMeterRegistry
to usebinderProviders
- theCacheMeterBinderProvider
instances that should be used to detect compatible caches
Method Detail
bindCacheToRegistry
public boolean bindCacheToRegistry(org.springframework.cache.Cache cache, io.micrometer.core.instrument.Tag... tags)
Attempt to bind the specifiedCache
to the registry. Returntrue
if the cache is supported and was bound to the registry,false
otherwise.- Parameters:
cache
- the cache to handletags
- the tags to associate with the metrics of that cache- Returns:
true
if thecache
is supported and was registered
getAdditionalTags
protected Iterable<io.micrometer.core.instrument.Tag> getAdditionalTags(org.springframework.cache.Cache cache)
Return additionaltags
to be associated with the givenCache
.- Parameters:
cache
- the cache- Returns:
- a list of additional tags to associate to that
cache
.