Class MetricUtils
java.lang.Object
de.hybris.platform.metrics.dropwizard.MetricUtils
Utility class to help in gathering metrics with
io.dropwizard.metrics:metrics-code library-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classClass used as a container to cache used Metric entities.static final classstatic final class -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<com.codahale.metrics.MetricRegistry>static <K> MetricUtils.CachedMetrics<K>The method creates a cache for metrics to reduce the number of times the metric name is created.static <K> MetricUtils.CachedMetrics<K>metricCache(com.codahale.metrics.MetricRegistry metricRegistry) The method creates a cache for metrics to reduce the number of times the metric name is createdmetricName(String name, String... names)
-
Method Details
-
getMetricRegistry
- Returns:
metricRegistryspring bean from currently active tenant. If no tenant is active, empty optional object is returned
-
metricName
- Parameters:
name- required metric namenames- additional (optional) parts of metric name- Returns:
- metric name builder
-
metricCache
The method creates a cache for metrics to reduce the number of times the metric name is created. When required, new metric will be created withmetricRegistryspring bean available in current tenant.- Type Parameters:
K- type of objects that will be used as keys in the metrics cache
-
metricCache
public static <K> MetricUtils.CachedMetrics<K> metricCache(com.codahale.metrics.MetricRegistry metricRegistry) The method creates a cache for metrics to reduce the number of times the metric name is created- Type Parameters:
K- type of objects that will be used as keys in the metrics cache- Parameters:
metricRegistry- the metric registry that should be used when creating the metrics. Ifnull, themetricRegistryspring bean available current tenant will be used
-