Modifier and Type | Class and Description |
---|---|
static interface |
MetricRegistry.MetricSupplier<T extends Metric> |
Constructor and Description |
---|
MetricRegistry()
Creates a new
MetricRegistry . |
Modifier and Type | Method and Description |
---|---|
void |
addListener(MetricRegistryListener listener)
Adds a
MetricRegistryListener to a collection of listeners that will be notified on
metric creation. |
Counter |
counter(java.lang.String name)
|
Counter |
counter(java.lang.String name,
MetricRegistry.MetricSupplier<Counter> supplier)
|
Gauge |
gauge(java.lang.String name,
MetricRegistry.MetricSupplier<Gauge> supplier)
|
java.util.SortedMap<java.lang.String,Counter> |
getCounters()
Returns a map of all the counters in the registry and their names.
|
java.util.SortedMap<java.lang.String,Counter> |
getCounters(MetricFilter filter)
Returns a map of all the counters in the registry and their names which match the given
filter.
|
java.util.SortedMap<java.lang.String,Gauge> |
getGauges()
Returns a map of all the gauges in the registry and their names.
|
java.util.SortedMap<java.lang.String,Gauge> |
getGauges(MetricFilter filter)
Returns a map of all the gauges in the registry and their names which match the given filter.
|
java.util.SortedMap<java.lang.String,Histogram> |
getHistograms()
Returns a map of all the histograms in the registry and their names.
|
java.util.SortedMap<java.lang.String,Histogram> |
getHistograms(MetricFilter filter)
Returns a map of all the histograms in the registry and their names which match the given
filter.
|
java.util.SortedMap<java.lang.String,Meter> |
getMeters()
Returns a map of all the meters in the registry and their names.
|
java.util.SortedMap<java.lang.String,Meter> |
getMeters(MetricFilter filter)
Returns a map of all the meters in the registry and their names which match the given filter.
|
java.util.Map<java.lang.String,Metric> |
getMetrics()
A map of metric names to metrics.
|
java.util.SortedSet<java.lang.String> |
getNames()
Returns a set of the names of all the metrics in the registry.
|
java.util.SortedMap<java.lang.String,Timer> |
getTimers()
Returns a map of all the timers in the registry and their names.
|
java.util.SortedMap<java.lang.String,Timer> |
getTimers(MetricFilter filter)
Returns a map of all the timers in the registry and their names which match the given filter.
|
Histogram |
histogram(java.lang.String name)
|
Histogram |
histogram(java.lang.String name,
MetricRegistry.MetricSupplier<Histogram> supplier)
|
Meter |
meter(java.lang.String name)
|
Meter |
meter(java.lang.String name,
MetricRegistry.MetricSupplier<Meter> supplier)
|
static java.lang.String |
name(java.lang.Class<?> klass,
java.lang.String... names)
Concatenates a class name and elements to form a dotted name, eliding any null values or
empty strings.
|
static java.lang.String |
name(java.lang.String name,
java.lang.String... names)
Concatenates elements to form a dotted name, eliding any null values or empty strings.
|
<T extends Metric> |
register(java.lang.String name,
T metric)
Given a
Metric , registers it under the given name. |
void |
registerAll(MetricSet metrics)
Given a metric set, registers them.
|
boolean |
remove(java.lang.String name)
Removes the metric with the given name.
|
void |
removeListener(MetricRegistryListener listener)
Removes a
MetricRegistryListener from this registry's collection of listeners. |
void |
removeMatching(MetricFilter filter)
Removes all metrics which match the given filter.
|
Timer |
timer(java.lang.String name)
|
Timer |
timer(java.lang.String name,
MetricRegistry.MetricSupplier<Timer> supplier)
|
public MetricRegistry()
MetricRegistry
.public static java.lang.String name(java.lang.String name, java.lang.String... names)
name
- the first element of the namenames
- the remaining elements of the namename
and names
concatenated by periodspublic static java.lang.String name(java.lang.Class<?> klass, java.lang.String... names)
klass
- the first element of the namenames
- the remaining elements of the nameklass
and names
concatenated by periodspublic <T extends Metric> T register(java.lang.String name, T metric) throws java.lang.IllegalArgumentException
Metric
, registers it under the given name.T
- the type of the metricname
- the name of the metricmetric
- the metricmetric
java.lang.IllegalArgumentException
- if the name is already registeredpublic void registerAll(MetricSet metrics) throws java.lang.IllegalArgumentException
metrics
- a set of metricsjava.lang.IllegalArgumentException
- if any of the names are already registeredpublic Counter counter(java.lang.String name)
Counter
registered under this name; or create and register
a new Counter
if none is registered.name
- the name of the metricCounter
public Counter counter(java.lang.String name, MetricRegistry.MetricSupplier<Counter> supplier)
Counter
registered under this name; or create and register
a new Counter
using the provided MetricSupplier if none is registered.name
- the name of the metricsupplier
- a MetricSupplier that can be used to manufacture a counter.Counter
public Histogram histogram(java.lang.String name)
Histogram
registered under this name; or create and register
a new Histogram
if none is registered.name
- the name of the metricHistogram
public Histogram histogram(java.lang.String name, MetricRegistry.MetricSupplier<Histogram> supplier)
Histogram
registered under this name; or create and register
a new Histogram
using the provided MetricSupplier if none is registered.name
- the name of the metricsupplier
- a MetricSupplier that can be used to manufacture a histogramHistogram
public Meter meter(java.lang.String name)
Meter
registered under this name; or create and register
a new Meter
if none is registered.name
- the name of the metricMeter
public Meter meter(java.lang.String name, MetricRegistry.MetricSupplier<Meter> supplier)
Meter
registered under this name; or create and register
a new Meter
using the provided MetricSupplier if none is registered.name
- the name of the metricsupplier
- a MetricSupplier that can be used to manufacture a MeterMeter
public Timer timer(java.lang.String name)
Timer
registered under this name; or create and register
a new Timer
if none is registered.name
- the name of the metricTimer
public Timer timer(java.lang.String name, MetricRegistry.MetricSupplier<Timer> supplier)
Timer
registered under this name; or create and register
a new Timer
using the provided MetricSupplier if none is registered.name
- the name of the metricsupplier
- a MetricSupplier that can be used to manufacture a TimerTimer
public Gauge gauge(java.lang.String name, MetricRegistry.MetricSupplier<Gauge> supplier)
Gauge
registered under this name; or create and register
a new Gauge
using the provided MetricSupplier if none is registered.name
- the name of the metricsupplier
- a MetricSupplier that can be used to manufacture a GaugeGauge
public boolean remove(java.lang.String name)
name
- the name of the metricpublic void removeMatching(MetricFilter filter)
filter
- a filterpublic void addListener(MetricRegistryListener listener)
MetricRegistryListener
to a collection of listeners that will be notified on
metric creation. Listeners will be notified in the order in which they are added.
N.B.: The listener will be notified of all existing metrics when it first registers.listener
- the listener that will be notifiedpublic void removeListener(MetricRegistryListener listener)
MetricRegistryListener
from this registry's collection of listeners.listener
- the listener that will be removedpublic java.util.SortedSet<java.lang.String> getNames()
public java.util.SortedMap<java.lang.String,Gauge> getGauges()
public java.util.SortedMap<java.lang.String,Gauge> getGauges(MetricFilter filter)
filter
- the metric filter to matchpublic java.util.SortedMap<java.lang.String,Counter> getCounters()
public java.util.SortedMap<java.lang.String,Counter> getCounters(MetricFilter filter)
filter
- the metric filter to matchpublic java.util.SortedMap<java.lang.String,Histogram> getHistograms()
public java.util.SortedMap<java.lang.String,Histogram> getHistograms(MetricFilter filter)
filter
- the metric filter to matchpublic java.util.SortedMap<java.lang.String,Meter> getMeters()
public java.util.SortedMap<java.lang.String,Meter> getMeters(MetricFilter filter)
filter
- the metric filter to matchpublic java.util.SortedMap<java.lang.String,Timer> getTimers()
public java.util.SortedMap<java.lang.String,Timer> getTimers(MetricFilter filter)
filter
- the metric filter to matchpublic java.util.Map<java.lang.String,Metric> getMetrics()
MetricSet
getMetrics
in interface MetricSet
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"