Class MetricUtils.CachedMetrics<K>

java.lang.Object
de.hybris.platform.metrics.dropwizard.MetricUtils.CachedMetrics<K>
Type Parameters:
K - class of cache key object. The class should meet all requirements of class used as a Map key.
Enclosing class:
MetricUtils

public static final class MetricUtils.CachedMetrics<K> extends Object
Class used as a container to cache used Metric entities. Main advantage is the reduced need of recalculating the metric name for each time the metric is used (which might be very often). The cache is storing metrics divided per tenant. The key of the cache should contain all data that differentiate the metric name.
  • Method Details

    • getMeter

      public Optional<com.codahale.metrics.Meter> getMeter(K key, String tenantID, Function<MetricUtils.MetricNameSupplierContext<K>,String> metricNameSupplier)
      Parameters:
      key - cache key for reuired metric
      tenantID - the tenant identifier
      metricNameSupplier - the method to calculate the metric name based on the key and tenantId
      Returns:
      the Meter object from cache. If cache does not contain the object for provided key, new object will be created for name calculated with provided metricNameSupplier. If creating a metric object can't be accomplished the return Optional will be emtpy.