public interface MetricRegistry
MetricFilter
Modifier and Type | Interface and Description |
---|---|
static class |
MetricRegistry.Type
Deprecated.
As of release 5.0, please use
APPLICATION_SCOPE ,
BASE_SCOPE or VENDOR_SCOPE with RegistryScope
instead. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLICATION_SCOPE
String constant to represent the scope value used for the application scope
|
static java.lang.String |
BASE_SCOPE
String constant to represent the scope value used for the base scope
|
static java.lang.String |
VENDOR_SCOPE
String constant to represent the scope value used for the vendor scope
|
Modifier and Type | Method and Description |
---|---|
Counter |
counter(Metadata metadata)
|
Counter |
counter(Metadata metadata,
Tag... tags)
|
Counter |
counter(MetricID metricID)
|
Counter |
counter(java.lang.String name)
|
Counter |
counter(java.lang.String name,
Tag... tags)
|
<T extends java.lang.Number> |
gauge(Metadata metadata,
java.util.function.Supplier<T> supplier,
Tag... tags)
|
<T,R extends java.lang.Number> |
gauge(Metadata metadata,
T object,
java.util.function.Function<T,R> func,
Tag... tags)
|
<T extends java.lang.Number> |
gauge(MetricID metricID,
java.util.function.Supplier<T> supplier)
|
<T,R extends java.lang.Number> |
gauge(MetricID metricID,
T object,
java.util.function.Function<T,R> func)
|
<T extends java.lang.Number> |
gauge(java.lang.String name,
java.util.function.Supplier<T> supplier,
Tag... tags)
|
<T,R extends java.lang.Number> |
gauge(java.lang.String name,
T object,
java.util.function.Function<T,R> func,
Tag... tags)
|
Counter |
getCounter(MetricID metricID)
|
java.util.SortedMap<MetricID,Counter> |
getCounters()
Returns a map of all the counters in the registry and their
MetricID s. |
java.util.SortedMap<MetricID,Counter> |
getCounters(MetricFilter filter)
Returns a map of all the counters in the registry and their
MetricID s which match the given filter. |
Gauge<?> |
getGauge(MetricID metricID)
|
java.util.SortedMap<MetricID,Gauge> |
getGauges()
Returns a map of all the gauges in the registry and their
MetricID s. |
java.util.SortedMap<MetricID,Gauge> |
getGauges(MetricFilter filter)
Returns a map of all the gauges in the registry and their
MetricID s which match the given filter. |
Histogram |
getHistogram(MetricID metricID)
|
java.util.SortedMap<MetricID,Histogram> |
getHistograms()
Returns a map of all the histograms in the registry and their
MetricID s. |
java.util.SortedMap<MetricID,Histogram> |
getHistograms(MetricFilter filter)
Returns a map of all the histograms in the registry and their
MetricID s which match the given filter. |
java.util.Map<java.lang.String,Metadata> |
getMetadata()
Returns a map of all the metadata in the registry and their names.
|
Metadata |
getMetadata(java.lang.String name)
Return the
Metadata for the provided name. |
Metric |
getMetric(MetricID metricID)
|
<T extends Metric> |
getMetric(MetricID metricID,
java.lang.Class<T> asType)
|
java.util.SortedSet<MetricID> |
getMetricIDs()
Returns a set of the
MetricID s of all the metrics in the registry. |
java.util.Map<MetricID,Metric> |
getMetrics()
Returns a map of all the metrics in the registry and their
MetricID s at query time. |
<T extends Metric> |
getMetrics(java.lang.Class<T> ofType,
MetricFilter filter)
Returns a map of all the metrics in the registry and their
MetricID s which match the given filter and
which are assignable to the provided type. |
java.util.SortedMap<MetricID,Metric> |
getMetrics(MetricFilter filter)
Returns a map of all the metrics in the registry and their
MetricID s which match the given filter. |
java.util.SortedSet<java.lang.String> |
getNames()
Returns a set of the names of all the metrics in the registry.
|
java.lang.String |
getScope()
Returns the scope of this metric registry.
|
Timer |
getTimer(MetricID metricID)
|
java.util.SortedMap<MetricID,Timer> |
getTimers()
Returns a map of all the timers in the registry and their
MetricID s. |
java.util.SortedMap<MetricID,Timer> |
getTimers(MetricFilter filter)
Returns a map of all the timers in the registry and their
MetricID s which match the given filter. |
Histogram |
histogram(Metadata metadata)
|
Histogram |
histogram(Metadata metadata,
Tag... tags)
|
Histogram |
histogram(MetricID metricID)
|
Histogram |
histogram(java.lang.String name)
|
Histogram |
histogram(java.lang.String name,
Tag... tags)
|
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.
|
boolean |
remove(MetricID metricID)
Removes the metric with the given MetricID
|
boolean |
remove(java.lang.String name)
Removes all metrics with the given name.
|
void |
removeMatching(MetricFilter filter)
Removes all metrics which match the given filter.
|
Timer |
timer(Metadata metadata)
|
Timer |
timer(Metadata metadata,
Tag... tags)
|
Timer |
timer(MetricID metricID)
|
Timer |
timer(java.lang.String name)
|
Timer |
timer(java.lang.String name,
Tag... tags)
|
static final java.lang.String APPLICATION_SCOPE
static final java.lang.String VENDOR_SCOPE
static final java.lang.String BASE_SCOPE
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 periodsstatic 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 periodsCounter counter(java.lang.String name)
Counter
registered under the MetricID
with this name and with no tags; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.name
- the name of the metricCounter
Counter counter(java.lang.String name, Tag... tags)
Counter
registered under the MetricID
with this name and with the provided
Tag
s; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.name
- the name of the metrictags
- the tags of the metricCounter
Counter counter(MetricID metricID)
Counter
registered under the MetricID
; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.metricID
- the ID of the metricCounter
Counter counter(Metadata metadata)
Counter
registered under the MetricID
with the Metadata
's name and with no
tags; or create and register a new Counter
if none is registered. If a Counter
was created, the
provided Metadata
object will be registered.
Note: During retrieval or creation, if a Metadata
object is already registered under this metric name and
is not equal to the provided Metadata
object then an exception will be thrown.
metadata
- the name of the metricCounter
Counter counter(Metadata metadata, Tag... tags)
Counter
registered under the MetricID
with the Metadata
's name and with the
provided Tag
s; or create and register a new Counter
if none is registered. If a Counter
was created, the provided Metadata
object will be registered.
Note: During retrieval or creation, if a Metadata
object is already registered under this metric name and
is not equal to the provided Metadata
object then an exception will be thrown.
metadata
- the name of the metrictags
- the tags of the metricCounter
<T,R extends java.lang.Number> Gauge<R> gauge(java.lang.String name, T object, java.util.function.Function<T,R> func, Tag... tags)
Gauge
of type Number
registered under the MetricID
with this
name and with the provided Tag
s; or create and register this gauge if none is registered.
If a Gauge
was created, a Metadata
object will be registered with the name and type. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.
The created Gauge
will apply a Function
to the provided object to
resolve a Number
value.T
- The Type of the Object of which the function func
is applied toR
- A Number
name
- The name of the Gauge metricobject
- The object that the Function
func
will be applied tofunc
- The Function
that will be applied to object
tags
- The tags of the metricGauge
<T,R extends java.lang.Number> Gauge<R> gauge(MetricID metricID, T object, java.util.function.Function<T,R> func)
Gauge
of type Number
registered under the MetricID
; or create
and register this gauge if none is registered.
If a Gauge
was created, a Metadata
object will be registered with the name and type. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.
The created Gauge
will apply a Function
to the provided object to
resolve a Number
value.T
- The Type of the Object of which the function func
is applied toR
- A Number
metricID
- The MetricID of the Gauge metricobject
- The object that the Function
func
will be applied tofunc
- The Function
that will be applied to object
Gauge
<T,R extends java.lang.Number> Gauge<R> gauge(Metadata metadata, T object, java.util.function.Function<T,R> func, Tag... tags)
Gauge
of type Number
registered under the MetricID
with
the @{link Metadata}'s name and with the provided Tag
s; or create and register this gauge if none is
registered.
If a Gauge
was created, a Metadata
object will be registered with the name and type. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.
The created Gauge
will apply a Function
to the provided object to
resolve a Number
value.T
- The Type of the Object of which the function func
is applied toR
- A Number
metadata
- The Metadata of the Gaugeobject
- The object that the Function
func
will be applied tofunc
- The Function
that will be applied to object
tags
- The tags of the metricGauge
<T extends java.lang.Number> Gauge<T> gauge(java.lang.String name, java.util.function.Supplier<T> supplier, Tag... tags)
Gauge
registered under the MetricID
with this name and with the provided Tag
s;
or create and register this gauge if none is registered.
If a Gauge
was created, a Metadata
object will be registered with the name and type. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.
The created Gauge
will return the value that the Supplier
will
provide.T
- A Number
name
- The name of the Gaugesupplier
- The Supplier
function that will return the value for the Gauge
metrictags
- The tags of the metricGauge
<T extends java.lang.Number> Gauge<T> gauge(MetricID metricID, java.util.function.Supplier<T> supplier)
Gauge
registered under the MetricID
; or create and register this gauge if none is
registered.
If a Gauge
was created, a Metadata
object will be registered with the name and type. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.
The created Gauge
will return the value that the Supplier
will
provide.<T extends java.lang.Number> Gauge<T> gauge(Metadata metadata, java.util.function.Supplier<T> supplier, Tag... tags)
Gauge
registered under the MetricID
with the @{link Metadata}'s name and with the
provided Tag
s; or create and register this gauge if none is registered.
If a Gauge
was created, a Metadata
object will be registered with the name and type. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.
The created Gauge
will return the value that the Supplier
will
provide.T
- A Number
metadata
- The metadata of the gaugesupplier
- The Supplier
function that will return the value for the Gauge
metrictags
- The tags of the metricGauge
Histogram histogram(java.lang.String name)
Histogram
registered under the MetricID
with this name and with no tags; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.name
- the name of the metricHistogram
Histogram histogram(java.lang.String name, Tag... tags)
Histogram
registered under the MetricID
with this name and with the provided
Tag
s; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.name
- the name of the metrictags
- the tags of the metricHistogram
Histogram histogram(MetricID metricID)
Histogram
registered under the MetricID
; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.metricID
- the ID of the metricHistogram
Histogram histogram(Metadata metadata)
Histogram
registered under the MetricID
with the Metadata
's name and with no
tags; or create and register a new Histogram
if none is registered. If a Histogram
was created,
the provided Metadata
object will be registered.
Note: During retrieval or creation, if a Metadata
object is already registered under this metric name and
is not equal to the provided Metadata
object then an exception will be thrown.
metadata
- the name of the metricHistogram
Histogram histogram(Metadata metadata, Tag... tags)
Histogram
registered under the MetricID
with the Metadata
's name and with the
provided Tag
s; or create and register a new Histogram
if none is registered. If a
Histogram
was created, the provided Metadata
object will be registered.
Note: During retrieval or creation, if a Metadata
object is already registered under this metric name and
is not equal to the provided Metadata
object then an exception will be thrown.
metadata
- the name of the metrictags
- the tags of the metricHistogram
Timer timer(java.lang.String name)
Timer
registered under the MetricID
with this name and with no tags; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.name
- the name of the metricTimer
Timer timer(java.lang.String name, Tag... tags)
Timer
registered under the MetricID
with this name and with the provided Tag
s;
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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.name
- the name of the metrictags
- the tags of the metricTimer
Timer timer(MetricID metricID)
Timer
registered under the MetricID
; 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. If a
Metadata
object is already registered with this metric name then that Metadata
will be used.metricID
- the ID of the metricTimer
Timer timer(Metadata metadata)
Timer
registered under the the MetricID
with the Metadata
's name and with no
tags; or create and register a new Timer
if none is registered. If a Timer
was created, the
provided Metadata
object will be registered.
Note: During retrieval or creation, if a Metadata
object is already registered under this metric name and
is not equal to the provided Metadata
object then an exception will be thrown.
metadata
- the name of the metricTimer
Timer timer(Metadata metadata, Tag... tags)
Timer
registered under the the MetricID
with the Metadata
's name and with the
provided Tag
s; or create and register a new Timer
if none is registered. If a Timer
was
created, the provided Metadata
object will be registered.
Note: During retrieval or creation, if a Metadata
object is already registered under this metric name and
is not equal to the provided Metadata
object then an exception will be thrown.
metadata
- the name of the metrictags
- the tags of the metricTimer
<T extends Metric> T getMetric(MetricID metricID, java.lang.Class<T> asType)
metricID
- lookup key, not null
asType
- the return type which is expected to be compatible with the actual type of the registered metricMetric
registered for the provided MetricID
or null
if none has been
registered so farjava.lang.IllegalArgumentException
- If the registered metric was not assignable to the provided typeMetadata getMetadata(java.lang.String name)
Metadata
for the provided name.name
- the name of the metricMetadata
for the provided name or null
if none has been registered for that nameboolean remove(java.lang.String name)
name
- the name of the metricboolean remove(MetricID metricID)
metricID
- the MetricID of the metricvoid removeMatching(MetricFilter filter)
filter
- a filterjava.util.SortedSet<java.lang.String> getNames()
java.util.SortedSet<MetricID> getMetricIDs()
MetricID
s of all the metrics in the registry.java.util.SortedMap<MetricID,Gauge> getGauges()
MetricID
s.java.util.SortedMap<MetricID,Gauge> getGauges(MetricFilter filter)
MetricID
s which match the given filter.filter
- the metric filter to matchjava.util.SortedMap<MetricID,Counter> getCounters()
MetricID
s.java.util.SortedMap<MetricID,Counter> getCounters(MetricFilter filter)
MetricID
s which match the given filter.filter
- the metric filter to matchjava.util.SortedMap<MetricID,Histogram> getHistograms()
MetricID
s.java.util.SortedMap<MetricID,Histogram> getHistograms(MetricFilter filter)
MetricID
s which match the given filter.filter
- the metric filter to matchjava.util.SortedMap<MetricID,Timer> getTimers()
MetricID
s.java.util.SortedMap<MetricID,Timer> getTimers(MetricFilter filter)
MetricID
s which match the given filter.filter
- the metric filter to matchjava.util.SortedMap<MetricID,Metric> getMetrics(MetricFilter filter)
MetricID
s which match the given filter.filter
- the metric filter to match<T extends Metric> java.util.SortedMap<MetricID,T> getMetrics(java.lang.Class<T> ofType, MetricFilter filter)
MetricID
s which match the given filter and
which are assignable to the provided type.ofType
- the type to which all returned metrics should be assignablefilter
- the metric filter to matchjava.util.Map<MetricID,Metric> getMetrics()
MetricID
s at query time. The only guarantee
about this method is that any key has a value (compared to using getMetric(MetricID)
and
getMetricIDs()
together).
It is only intended for bulk querying, if you need a single or a few entries, always prefer
getMetric(MetricID)
or getMetrics(MetricFilter)
.java.util.Map<java.lang.String,Metadata> getMetadata()
getMetadata(String)
.
It is only intended for bulk querying, if you need a single or a few metadata, always prefer
getMetadata(String)
}.java.lang.String getScope()