public abstract class MetricRegistry
extends java.lang.Object
MetricFilter
Modifier and Type | Class and Description |
---|---|
static class |
MetricRegistry.Type
An enumeration representing the scopes of the MetricRegistry
|
Constructor and Description |
---|
MetricRegistry() |
Modifier and Type | Method and Description |
---|---|
abstract Counter |
counter(Metadata metadata)
|
abstract Counter |
counter(java.lang.String name)
|
abstract java.util.SortedMap<java.lang.String,Counter> |
getCounters()
Returns a map of all the counters in the registry and their names.
|
abstract 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.
|
abstract java.util.SortedMap<java.lang.String,Gauge> |
getGauges()
Returns a map of all the gauges in the registry and their names.
|
abstract 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.
|
abstract java.util.SortedMap<java.lang.String,Histogram> |
getHistograms()
Returns a map of all the histograms in the registry and their names.
|
abstract 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.
|
abstract java.util.Map<java.lang.String,Metadata> |
getMetadata()
Returns a map of all the metadata in the registry and their names.
|
abstract java.util.SortedMap<java.lang.String,Meter> |
getMeters()
Returns a map of all the meters in the registry and their names.
|
abstract 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.
|
abstract java.util.Map<java.lang.String,Metric> |
getMetrics()
Returns a map of all the metrics in the registry and their names.
|
abstract java.util.SortedSet<java.lang.String> |
getNames()
Returns a set of the names of all the metrics in the registry.
|
abstract java.util.SortedMap<java.lang.String,Timer> |
getTimers()
Returns a map of all the timers in the registry and their names.
|
abstract 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.
|
abstract Histogram |
histogram(Metadata metadata)
|
abstract Histogram |
histogram(java.lang.String name)
|
abstract Meter |
meter(Metadata metadata)
|
abstract Meter |
meter(java.lang.String name)
|
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.
|
abstract <T extends Metric> |
register(Metadata metadata,
T metric)
|
abstract <T extends Metric> |
register(java.lang.String name,
T metric)
Given a
Metric , registers it under the given name. |
abstract <T extends Metric> |
register(java.lang.String name,
T metric,
Metadata metadata)
Deprecated.
As of version 1.1, use
register(Metadata, Metric) instead |
abstract boolean |
remove(java.lang.String name)
Removes the metric with the given name.
|
abstract void |
removeMatching(MetricFilter filter)
Removes all metrics which match the given filter.
|
abstract Timer |
timer(Metadata metadata)
|
abstract Timer |
timer(java.lang.String name)
|
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 abstract <T extends Metric> T register(java.lang.String name, T metric) throws java.lang.IllegalArgumentException
Metric
, registers it under the given name.
A Metadata
object will be registered with the name and type.T
- the type of the metricname
- the name of the metricmetric
- the metricmetric
java.lang.IllegalArgumentException
- if the name is already registered@Deprecated public abstract <T extends Metric> T register(java.lang.String name, T metric, Metadata metadata) throws java.lang.IllegalArgumentException
register(Metadata, Metric)
insteadT
- the type of the metricname
- the name of the metricmetric
- the metricmetadata
- the metadatametric
java.lang.IllegalArgumentException
- if the name is already registeredpublic abstract <T extends Metric> T register(Metadata metadata, T metric) throws java.lang.IllegalArgumentException
T
- the type of the metricmetadata
- the metadatametric
- the metricmetric
java.lang.IllegalArgumentException
- if the name is already registeredpublic abstract Counter counter(java.lang.String name)
Counter
registered under this name; or create and register
a new Counter
if none is registered.
If a Counter
was created, a Metadata
object will be registered with the name and type.name
- the name of the metricCounter
public abstract Counter counter(Metadata metadata)
Counter
registered under the Metadata
's name; or create and register
a new Counter
if none is registered.
If a Counter
was created, the provided Metadata
object will be registered.
Note: The Metadata
will not be updated if the metric is already registered.
metadata
- the name of the metricCounter
public abstract Histogram histogram(java.lang.String name)
Histogram
registered under this name; or create and register
a new Histogram
if none is registered.
If a Histogram
was created, a Metadata
object will be registered with the name and type.name
- the name of the metricHistogram
public abstract Histogram histogram(Metadata metadata)
Histogram
registered under the Metadata
's name; or create and register
a new Histogram
if none is registered.
If a Histogram
was created, the provided Metadata
object will be registered.
Note: The Metadata
will not be updated if the metric is already registered.
metadata
- the name of the metricHistogram
public abstract Meter meter(java.lang.String name)
Meter
registered under this name; or create and register
a new Meter
if none is registered.
If a Meter
was created, a Metadata
object will be registered with the name and type.name
- the name of the metricMeter
public abstract Meter meter(Metadata metadata)
Meter
registered under the Metadata
's name; or create and register
a new Meter
if none is registered.
If a Meter
was created, the provided Metadata
object will be registered.
Note: The Metadata
will not be updated if the metric is already registered.
metadata
- the name of the metricMeter
public abstract Timer timer(java.lang.String name)
Timer
registered under this name; or create and register
a new Timer
if none is registered.
If a Timer
was created, a Metadata
object will be registered with the name and type.name
- the name of the metricTimer
public abstract Timer timer(Metadata metadata)
Timer
registered under the Metadata
's name; or create and register
a new Timer
if none is registered.
If a Timer
was created, the provided Metadata
object will be registered.
Note: The Metadata
will not be updated if the metric is already registered.
metadata
- the name of the metricTimer
public abstract boolean remove(java.lang.String name)
name
- the name of the metricpublic abstract void removeMatching(MetricFilter filter)
filter
- a filterpublic abstract java.util.SortedSet<java.lang.String> getNames()
public abstract java.util.SortedMap<java.lang.String,Gauge> getGauges()
public abstract java.util.SortedMap<java.lang.String,Gauge> getGauges(MetricFilter filter)
filter
- the metric filter to matchpublic abstract java.util.SortedMap<java.lang.String,Counter> getCounters()
public abstract java.util.SortedMap<java.lang.String,Counter> getCounters(MetricFilter filter)
filter
- the metric filter to matchpublic abstract java.util.SortedMap<java.lang.String,Histogram> getHistograms()
public abstract java.util.SortedMap<java.lang.String,Histogram> getHistograms(MetricFilter filter)
filter
- the metric filter to matchpublic abstract java.util.SortedMap<java.lang.String,Meter> getMeters()
public abstract java.util.SortedMap<java.lang.String,Meter> getMeters(MetricFilter filter)
filter
- the metric filter to matchpublic abstract java.util.SortedMap<java.lang.String,Timer> getTimers()
public abstract java.util.SortedMap<java.lang.String,Timer> getTimers(MetricFilter filter)
filter
- the metric filter to matchpublic abstract java.util.Map<java.lang.String,Metric> getMetrics()
public abstract java.util.Map<java.lang.String,Metadata> getMetadata()