@InterfaceAudience.Private public class MetricRegistryImpl extends Object implements MetricRegistry
MetricRegistry.| Modifier and Type | Field and Description |
|---|---|
private MetricRegistryInfo |
info |
private ConcurrentMap<String,Metric> |
metrics |
| Constructor and Description |
|---|
MetricRegistryImpl(MetricRegistryInfo info) |
| Modifier and Type | Method and Description |
|---|---|
Counter |
counter(String name)
Get or construct a
Counter used to track a mutable number. |
protected Counter |
createCounter() |
protected Histogram |
createHistogram() |
protected Meter |
createMeter() |
protected Timer |
createTimer() |
Optional<Metric> |
get(String name)
Returns previously registered metric with the name if any.
|
MetricRegistryInfo |
getMetricRegistryInfo()
Return the MetricRegistryInfo object for this registry.
|
Map<String,Metric> |
getMetrics()
A map of metric names to metrics.
|
Histogram |
histogram(String name)
Get or construct a
Histogram used to measure a distribution of values. |
Meter |
meter(String name)
|
<T> Gauge<T> |
register(String name,
Gauge<T> gauge)
Register a
Gauge. |
Metric |
register(String name,
Metric metric)
Registers the
Metric with the given name if there does not exist one with the same
name. |
void |
registerAll(MetricSet metricSet)
Registers the
Metrics in the given MetricSet. |
boolean |
remove(String name)
Removes the metric with the given name.
|
Timer |
timer(String name)
Get or construct a
Timer used to measure durations and report rates. |
private final MetricRegistryInfo info
private final ConcurrentMap<String,Metric> metrics
public MetricRegistryImpl(MetricRegistryInfo info)
public Timer timer(String name)
MetricRegistryTimer used to measure durations and report rates.timer in interface MetricRegistryname - the name of the timer.Timer.protected Timer createTimer()
public Histogram histogram(String name)
MetricRegistryHistogram used to measure a distribution of values.histogram in interface MetricRegistryname - The name of the Histogram.Histogram.protected Histogram createHistogram()
public Meter meter(String name)
MetricRegistryMeter used to measure durations and report distributions (a
combination of a Timer and a Histogram.meter in interface MetricRegistryname - The name of the Meter.Meter.protected Meter createMeter()
public Counter counter(String name)
MetricRegistryCounter used to track a mutable number.counter in interface MetricRegistryname - The name of the CounterCounter.protected Counter createCounter()
public Optional<Metric> get(String name)
MetricRegistryget in interface MetricRegistryname - the name of the metricpublic Metric register(String name, Metric metric)
MetricRegistryMetric with the given name if there does not exist one with the same
name. Returns the newly registered or existing Metric.register in interface MetricRegistryname - The name of the Metric.metric - the metric to registerpublic <T> Gauge<T> register(String name, Gauge<T> gauge)
MetricRegistryGauge. The Gauge will be invoked at a period defined by the implementation
of MetricRegistry.register in interface MetricRegistryname - The name of the Gauge.gauge - A callback to compute the current value.public void registerAll(MetricSet metricSet)
MetricRegistryMetrics in the given MetricSet.registerAll in interface MetricRegistrymetricSet - set of metrics to register.public Map<String,Metric> getMetrics()
MetricSetgetMetrics in interface MetricSetpublic boolean remove(String name)
MetricRegistryremove in interface MetricRegistryname - the name of the metricpublic MetricRegistryInfo getMetricRegistryInfo()
MetricRegistrygetMetricRegistryInfo in interface MetricRegistryCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.