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 Summary

    Modifier and Type
    Method
    Description
    void
    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
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • recordHits

      public void recordHits(@org.checkerframework.checker.index.qual.NonNegative int count)
      Specified by:
      recordHits in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • recordMisses

      public void recordMisses(@org.checkerframework.checker.index.qual.NonNegative int count)
      Specified by:
      recordMisses in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • recordLoadSuccess

      public void recordLoadSuccess(@org.checkerframework.checker.index.qual.NonNegative long loadTime)
      Specified by:
      recordLoadSuccess in interface com.github.benmanes.caffeine.cache.stats.StatsCounter
    • recordLoadFailure

      public void recordLoadFailure(@org.checkerframework.checker.index.qual.NonNegative long loadTime)
      Specified by:
      recordLoadFailure in interface com.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 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