Package io.micrometer.spring.cache
Class CacheMetricsRegistrar
- java.lang.Object
-
- io.micrometer.spring.cache.CacheMetricsRegistrar
-
public class CacheMetricsRegistrar extends java.lang.ObjectRegister supportedCacheto aMeterRegistry.- Since:
- 1.2.0
-
-
Constructor Summary
Constructors Constructor Description CacheMetricsRegistrar(io.micrometer.core.instrument.MeterRegistry registry, java.util.Collection<CacheMeterBinderProvider<?>> binderProviders)Creates a new registrar.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbindCacheToRegistry(org.springframework.cache.Cache cache, io.micrometer.core.instrument.Tag... tags)Attempt to bind the specifiedCacheto the registry.protected java.lang.Iterable<io.micrometer.core.instrument.Tag>getAdditionalTags(org.springframework.cache.Cache cache)Return additionaltagsto be associated with the givenCache.
-
-
-
Constructor Detail
-
CacheMetricsRegistrar
public CacheMetricsRegistrar(io.micrometer.core.instrument.MeterRegistry registry, java.util.Collection<CacheMeterBinderProvider<?>> binderProviders)Creates a new registrar.- Parameters:
registry- theMeterRegistryto usebinderProviders- theCacheMeterBinderProviderinstances 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 specifiedCacheto the registry. Returntrueif the cache is supported and was bound to the registry,falseotherwise.- Parameters:
cache- the cache to handletags- the tags to associate with the metrics of that cache- Returns:
trueif thecacheis supported and was registered
-
getAdditionalTags
protected java.lang.Iterable<io.micrometer.core.instrument.Tag> getAdditionalTags(org.springframework.cache.Cache cache)
Return additionaltagsto be associated with the givenCache.- Parameters:
cache- the cache- Returns:
- a list of additional tags to associate to that
cache.
-
-