Package org.forgerock.openig.tools
Class CommonsMonitoringStatsCounter
java.lang.Object
org.forgerock.openig.tools.CommonsMonitoringStatsCounter
- All Implemented Interfaces:
com.github.benmanes.caffeine.cache.stats.StatsCounter
public class CommonsMonitoringStatsCounter
extends Object
implements com.github.benmanes.caffeine.cache.stats.StatsCounter
Expose Caffeine's
StatsCounter
in our own MeterRegistry
.
It exposes the following metrics:
- cache.gets.total: COUNTER, cache hit/miss ratios
Tags:- result:hit: Incremented when a cache request hits an entry
- result:miss: Incremented when a cache request misses an entry
- cache.loads: TIMER, Track time spent loading entries
Tags:- result:success: Updated when an entry is loaded successfully
- result:failure: Updated when an entry fails to load
- cache.evictions: DISTRIBUTION SUMMARY, Distribution of evictions events
Tags:- cause: Record the reason of the eviction (size, expiration, explicit, ...)
All the above metrics have a type tag that describes the kind of content in the cache (session, token, ...).
-
Constructor Summary
ConstructorDescriptionCommonsMonitoringStatsCounter
(org.forgerock.monitoring.api.instrument.MeterRegistry registry, String type) Constructs a new CaffeineStatsCounter
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
recordEviction
(@org.checkerframework.checker.index.qual.NonNegative int weight, com.github.benmanes.caffeine.cache.RemovalCause cause) void
recordHits
(@org.checkerframework.checker.index.qual.NonNegative int count) void
recordLoadFailure
(@org.checkerframework.checker.index.qual.NonNegative long loadTime) void
recordLoadSuccess
(@org.checkerframework.checker.index.qual.NonNegative long loadTime) void
recordMisses
(@org.checkerframework.checker.index.qual.NonNegative int count) com.github.benmanes.caffeine.cache.stats.CacheStats
snapshot()
-
Constructor Details
-
CommonsMonitoringStatsCounter
public CommonsMonitoringStatsCounter(org.forgerock.monitoring.api.instrument.MeterRegistry registry, String type) Constructs a new CaffeineStatsCounter
.- Parameters:
registry
- COMMONS Monitoring Registrytype
- type describing the cache content
-
-
Method Details
-
recordHits
public void recordHits(@org.checkerframework.checker.index.qual.NonNegative int count) - Specified by:
recordHits
in interfacecom.github.benmanes.caffeine.cache.stats.StatsCounter
-
recordMisses
public void recordMisses(@org.checkerframework.checker.index.qual.NonNegative int count) - Specified by:
recordMisses
in interfacecom.github.benmanes.caffeine.cache.stats.StatsCounter
-
recordLoadSuccess
public void recordLoadSuccess(@org.checkerframework.checker.index.qual.NonNegative long loadTime) - Specified by:
recordLoadSuccess
in interfacecom.github.benmanes.caffeine.cache.stats.StatsCounter
-
recordLoadFailure
public void recordLoadFailure(@org.checkerframework.checker.index.qual.NonNegative long loadTime) - Specified by:
recordLoadFailure
in interfacecom.github.benmanes.caffeine.cache.stats.StatsCounter
-
recordEviction
public void recordEviction(@org.checkerframework.checker.index.qual.NonNegative int weight, com.github.benmanes.caffeine.cache.RemovalCause cause) - Specified by:
recordEviction
in interfacecom.github.benmanes.caffeine.cache.stats.StatsCounter
-
snapshot
public com.github.benmanes.caffeine.cache.stats.CacheStats snapshot()- Specified by:
snapshot
in interfacecom.github.benmanes.caffeine.cache.stats.StatsCounter
-