public class MetricUtils extends Object
Constructor and Description |
---|
MetricUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addMetrics(NamedList<Object> lst,
com.codahale.metrics.Timer timer)
Adds metrics from a Timer to a NamedList, using well-known back-compat names.
|
static ExecutorService |
instrumentedExecutorService(ExecutorService delegate,
com.codahale.metrics.MetricRegistry metricRegistry,
String scope)
Returns an instrumented wrapper over the given executor service.
|
static double |
nsToMs(double ns)
Converts a double representing nanoseconds to a double representing milliseconds.
|
static void |
toMaps(com.codahale.metrics.MetricRegistry registry,
List<com.codahale.metrics.MetricFilter> shouldMatchFilters,
com.codahale.metrics.MetricFilter mustMatchFilter,
boolean skipHistograms,
boolean skipAggregateValues,
boolean compact,
BiConsumer<String,Object> consumer) |
static NamedList |
toNamedList(com.codahale.metrics.MetricRegistry registry,
List<com.codahale.metrics.MetricFilter> shouldMatchFilters,
com.codahale.metrics.MetricFilter mustMatchFilter,
boolean skipHistograms,
boolean skipAggregateValues,
boolean compact,
Map<String,Object> metadata)
Returns a NamedList representation of the given metric registry.
|
public static final String VALUE
public static void addMetrics(NamedList<Object> lst, com.codahale.metrics.Timer timer)
lst
- The NamedList to add the metrics data totimer
- The Timer to extract the metrics frompublic static double nsToMs(double ns)
ns
- the amount of time in nanosecondspublic static NamedList toNamedList(com.codahale.metrics.MetricRegistry registry, List<com.codahale.metrics.MetricFilter> shouldMatchFilters, com.codahale.metrics.MetricFilter mustMatchFilter, boolean skipHistograms, boolean skipAggregateValues, boolean compact, Map<String,Object> metadata)
registry
- the MetricRegistry
to be converted to NamedListshouldMatchFilters
- a list of MetricFilter
instances.
A metric must match any one of the filters from this list to be
included in the outputmustMatchFilter
- a MetricFilter
.
A metric must match this filter to be included in the output.skipHistograms
- discard any Histogram
-s and histogram parts of Timer
-s.compact
- use compact representation for counters and gauges.metadata
- optional metadata. If not null and not empty then this map will be added under a
_metadata_
key.NamedList
public static void toMaps(com.codahale.metrics.MetricRegistry registry, List<com.codahale.metrics.MetricFilter> shouldMatchFilters, com.codahale.metrics.MetricFilter mustMatchFilter, boolean skipHistograms, boolean skipAggregateValues, boolean compact, BiConsumer<String,Object> consumer)
public static ExecutorService instrumentedExecutorService(ExecutorService delegate, com.codahale.metrics.MetricRegistry metricRegistry, String scope)
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.