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 aMapkey.
- Enclosing class:
- MetricUtils
public static final class MetricUtils.CachedMetrics<K> extends java.lang.ObjectClass 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<com.codahale.metrics.Meter>getMeter(K key, java.lang.String tenantID, java.util.function.Function<MetricUtils.MetricNameSupplierContext<K>,java.lang.String> metricNameSupplier)
-
-
-
Method Detail
-
getMeter
public java.util.Optional<com.codahale.metrics.Meter> getMeter(K key, java.lang.String tenantID, java.util.function.Function<MetricUtils.MetricNameSupplierContext<K>,java.lang.String> metricNameSupplier)
- Parameters:
key- cache key for reuired metrictenantID- the tenant identifiermetricNameSupplier- the method to calculate the metric name based on thekeyandtenantId- Returns:
- the
Meterobject from cache. If cache does not contain the object for provided key, new object will be created for name calculated with providedmetricNameSupplier. If creating a metric object can't be accomplished the return Optional will be emtpy.
-
-