Class MetricUtils
- java.lang.Object
-
- de.hybris.platform.metrics.dropwizard.MetricUtils
-
public final class MetricUtils extends java.lang.ObjectUtility class to help in gathering metrics withio.dropwizard.metrics:metrics-codelibrary
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMetricUtils.CachedMetrics<K>Class used as a container to cache used Metric entities.static classMetricUtils.MetricNameBuilderstatic classMetricUtils.MetricNameSupplierContext<K>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<com.codahale.metrics.MetricRegistry>getMetricRegistry()static <K> MetricUtils.CachedMetrics<K>metricCache()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 createdstatic MetricUtils.MetricNameBuildermetricName(java.lang.String name, java.lang.String... names)
-
-
-
Method Detail
-
getMetricRegistry
public static java.util.Optional<com.codahale.metrics.MetricRegistry> getMetricRegistry()
- Returns:
metricRegistryspring bean from currently active tenant. If no tenant is active, empty optional object is returned
-
metricName
public static MetricUtils.MetricNameBuilder metricName(java.lang.String name, java.lang.String... names)
- Parameters:
name- required metric namenames- additional (optional) parts of metric name- Returns:
- metric name builder
-
metricCache
public static <K> MetricUtils.CachedMetrics<K> 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
-
-