Class EhCache2Metrics

java.lang.Object
io.micrometer.core.instrument.binder.cache.CacheMeterBinder<net.sf.ehcache.Ehcache>
io.micrometer.core.instrument.binder.cache.EhCache2Metrics
All Implemented Interfaces:
MeterBinder

@NonNullApi @NonNullFields public class EhCache2Metrics extends CacheMeterBinder<net.sf.ehcache.Ehcache>
Collect metrics on EhCache caches, including detailed metrics on transactions and storage space.
  • Constructor Details

    • EhCache2Metrics

      public EhCache2Metrics(net.sf.ehcache.Ehcache cache, Iterable<Tag> tags)
  • Method Details

    • monitor

      public static net.sf.ehcache.Ehcache monitor(MeterRegistry registry, net.sf.ehcache.Ehcache cache, String... tags)
      Record metrics on an EhCache cache.
      Parameters:
      registry - The registry to bind metrics to.
      cache - The cache to instrument.
      tags - Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.
      Returns:
      The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
    • monitor

      public static net.sf.ehcache.Ehcache monitor(MeterRegistry registry, net.sf.ehcache.Ehcache cache, Iterable<Tag> tags)
      Record metrics on an EhCache cache.
      Parameters:
      registry - The registry to bind metrics to.
      cache - The cache to instrument.
      tags - Tags to apply to all recorded metrics.
      Returns:
      The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
    • size

      protected Long size()
      Description copied from class: CacheMeterBinder
      MOST cache implementations provide a means of retrieving the number of entries. Even if
      Specified by:
      size in class CacheMeterBinder<net.sf.ehcache.Ehcache>
      Returns:
      Total number of cache entries. This value may go up or down with puts, removes, and evictions. Returns null if the cache implementation does not provide a way to track cache size.
    • hitCount

      protected long hitCount()
      Specified by:
      hitCount in class CacheMeterBinder<net.sf.ehcache.Ehcache>
      Returns:
      Get requests that resulted in a "hit" against an existing cache entry. Monotonically increasing hit count.
    • missCount

      protected Long missCount()
      Specified by:
      missCount in class CacheMeterBinder<net.sf.ehcache.Ehcache>
      Returns:
      Get requests that resulted in a "miss", or didn't match an existing cache entry. Monotonically increasing count. Returns null if the cache implementation does not provide a way to track miss count, especially in distributed caches.
    • evictionCount

      protected Long evictionCount()
      Specified by:
      evictionCount in class CacheMeterBinder<net.sf.ehcache.Ehcache>
      Returns:
      Total number of entries that have been evicted from the cache. Monotonically increasing eviction count. Returns null if the cache implementation does not support eviction, or does not provide a way to track the eviction count.
    • putCount

      protected long putCount()
      Description copied from class: CacheMeterBinder
      The put mechanism is unimportant - this count applies to entries added to the cache according to a pre-defined load function such as exists in Guava/Caffeine caches as well as manual puts. Note that Guava/Caffeine caches don't count manual puts.
      Specified by:
      putCount in class CacheMeterBinder<net.sf.ehcache.Ehcache>
      Returns:
      Total number of entries added to the cache. Monotonically increasing count.
    • bindImplementationSpecificMetrics

      protected void bindImplementationSpecificMetrics(MeterRegistry registry)
      Description copied from class: CacheMeterBinder
      Bind detailed metrics that are particular to the cache implementation, e.g. load duration for Caffeine caches, heap and disk size for EhCache caches. These metrics are above and beyond the basic set of metrics that is common to all caches.
      Specified by:
      bindImplementationSpecificMetrics in class CacheMeterBinder<net.sf.ehcache.Ehcache>
      Parameters:
      registry - The registry to bind metrics to.