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
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 Summary
-
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 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.
-