Class CommonsMonitoringStatsCounter

java.lang.Object
org.forgerock.openig.tools.cache.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, ...).

  • Method Details

    • recordHits

      public void recordHits(int count)
      Specified by:
      recordHits in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • recordMisses

      public void recordMisses(int count)
      Specified by:
      recordMisses in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • recordLoadSuccess

      public void recordLoadSuccess(long loadTime)
      Specified by:
      recordLoadSuccess in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • recordLoadFailure

      public void recordLoadFailure(long loadTime)
      Specified by:
      recordLoadFailure in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • recordEviction

      public void recordEviction(int weight, com.github.benmanes.caffeine.cache.RemovalCause cause)
      Specified by:
      recordEviction in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • snapshot

      public com.github.benmanes.caffeine.cache.stats.CacheStats snapshot()
      Specified by:
      snapshot in interface com.github.benmanes.caffeine.cache.stats.StatsCounter