Interface MetricRegistry
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
String constant to represent the scope value used for the application scopestatic final String
String constant to represent the scope value used for the base scopestatic final String
String constant to represent the scope value used for the vendor scope -
Method Summary
Modifier and TypeMethodDescriptiongetCounter
(MetricID metricID) Returns a map of all the counters in the registry and theirMetricID
s.getCounters
(MetricFilter filter) Returns a map of all the counters in the registry and theirMetricID
s which match the given filter.Gauge<?>
Returns a map of all the gauges in the registry and theirMetricID
s.getGauges
(MetricFilter filter) Returns a map of all the gauges in the registry and theirMetricID
s which match the given filter.getHistogram
(MetricID metricID) Returns a map of all the histograms in the registry and theirMetricID
s.getHistograms
(MetricFilter filter) Returns a map of all the histograms in the registry and theirMetricID
s which match the given filter.Returns a map of all the metadata in the registry and their names.getMetadata
(String name) Return theMetadata
for the provided name.<T extends Metric>
TReturns a set of theMetricID
s of all the metrics in the registry.Returns a map of all the metrics in the registry and theirMetricID
s at query time.getMetrics
(Class<T> ofType, MetricFilter filter) Returns a map of all the metrics in the registry and theirMetricID
s which match the given filter and which are assignable to the provided type.getMetrics
(MetricFilter filter) Returns a map of all the metrics in the registry and theirMetricID
s which match the given filter.getNames()
Returns a set of the names of all the metrics in the registry.getScope()
Returns the scope of this metric registry.Returns a map of all the timers in the registry and theirMetricID
s.getTimers
(MetricFilter filter) Returns a map of all the timers in the registry and theirMetricID
s which match the given filter.static String
Concatenates a class name and elements to form a dotted name, eliding any null values or empty strings.static String
Concatenates elements to form a dotted name, eliding any null values or empty strings.boolean
Removes all metrics with the given name.boolean
Removes the metric with the given MetricIDvoid
removeMatching
(MetricFilter filter) Removes all metrics which match the given filter.
-
Field Details
-
APPLICATION_SCOPE
String constant to represent the scope value used for the application scope- See Also:
-
VENDOR_SCOPE
String constant to represent the scope value used for the vendor scope- See Also:
-
BASE_SCOPE
String constant to represent the scope value used for the base scope- See Also:
-
-
Method Details
-
name
Concatenates elements to form a dotted name, eliding any null values or empty strings.- Parameters:
name
- the first element of the namenames
- the remaining elements of the name- Returns:
name
andnames
concatenated by periods
-
name
Concatenates a class name and elements to form a dotted name, eliding any null values or empty strings.- Parameters:
klass
- the first element of the namenames
- the remaining elements of the name- Returns:
klass
andnames
concatenated by periods
-
counter
Return theCounter
registered under theMetricID
with this name and with no tags; or create and register a newCounter
if none is registered. If aCounter
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
name
- the name of the metric- Returns:
- a new or pre-existing
Counter
-
counter
Return theCounter
registered under theMetricID
with this name and with the providedTag
s; or create and register a newCounter
if none is registered. If aCounter
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
name
- the name of the metrictags
- the tags of the metric- Returns:
- a new or pre-existing
Counter
- Since:
- 2.0
-
counter
Return theCounter
registered under theMetricID
; or create and register a newCounter
if none is registered. If aCounter
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
metricID
- the ID of the metric- Returns:
- a new or pre-existing
Counter
- Since:
- 3.0
-
counter
Return theCounter
registered under theMetricID
with theMetadata
's name and with no tags; or create and register a newCounter
if none is registered. If aCounter
was created, the providedMetadata
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 providedMetadata
object then an exception will be thrown.- Parameters:
metadata
- the name of the metric- Returns:
- a new or pre-existing
Counter
-
counter
Return theCounter
registered under theMetricID
with theMetadata
's name and with the providedTag
s; or create and register a newCounter
if none is registered. If aCounter
was created, the providedMetadata
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 providedMetadata
object then an exception will be thrown.- Parameters:
metadata
- the name of the metrictags
- the tags of the metric- Returns:
- a new or pre-existing
Counter
- Since:
- 2.0
-
gauge
Return theGauge
of typeNumber
registered under theMetricID
with this name and with the providedTag
s; or create and register this gauge if none is registered. If aGauge
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used. The createdGauge
will apply aFunction
to the provided object to resolve aNumber
value.- Type Parameters:
T
- The Type of the Object of which the functionfunc
is applied toR
- ANumber
- Parameters:
name
- The name of the Gauge metricobject
- The object that theFunction
func
will be applied tofunc
- TheFunction
that will be applied toobject
tags
- The tags of the metric- Returns:
- a new or pre-existing
Gauge
- Since:
- 3.0
-
gauge
Return theGauge
of typeNumber
registered under theMetricID
; or create and register this gauge if none is registered. If aGauge
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used. The createdGauge
will apply aFunction
to the provided object to resolve aNumber
value.- Type Parameters:
T
- The Type of the Object of which the functionfunc
is applied toR
- ANumber
- Parameters:
metricID
- The MetricID of the Gauge metricobject
- The object that theFunction
func
will be applied tofunc
- TheFunction
that will be applied toobject
- Returns:
- a new or pre-existing
Gauge
- Since:
- 3.0
-
gauge
Return theGauge
of typeNumber
registered under theMetricID
with the @{link Metadata}'s name and with the providedTag
s; or create and register this gauge if none is registered. If aGauge
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used. The createdGauge
will apply aFunction
to the provided object to resolve aNumber
value.- Type Parameters:
T
- The Type of the Object of which the functionfunc
is applied toR
- ANumber
- Parameters:
metadata
- The Metadata of the Gaugeobject
- The object that theFunction
func
will be applied tofunc
- TheFunction
that will be applied toobject
tags
- The tags of the metric- Returns:
- a new or pre-existing
Gauge
- Since:
- 3.0
-
gauge
Return theGauge
registered under theMetricID
with this name and with the providedTag
s; or create and register this gauge if none is registered. If aGauge
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used. The createdGauge
will return the value that theSupplier
will provide. -
gauge
Return theGauge
registered under theMetricID
; or create and register this gauge if none is registered. If aGauge
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used. The createdGauge
will return the value that theSupplier
will provide. -
gauge
Return theGauge
registered under theMetricID
with the @{link Metadata}'s name and with the providedTag
s; or create and register this gauge if none is registered. If aGauge
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used. The createdGauge
will return the value that theSupplier
will provide. -
histogram
Return theHistogram
registered under theMetricID
with this name and with no tags; or create and register a newHistogram
if none is registered. If aHistogram
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
name
- the name of the metric- Returns:
- a new or pre-existing
Histogram
-
histogram
Return theHistogram
registered under theMetricID
with this name and with the providedTag
s; or create and register a newHistogram
if none is registered. If aHistogram
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
name
- the name of the metrictags
- the tags of the metric- Returns:
- a new or pre-existing
Histogram
- Since:
- 2.0
-
histogram
Return theHistogram
registered under theMetricID
; or create and register a newHistogram
if none is registered. If aHistogram
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
metricID
- the ID of the metric- Returns:
- a new or pre-existing
Histogram
- Since:
- 3.0
-
histogram
Return theHistogram
registered under theMetricID
with theMetadata
's name and with no tags; or create and register a newHistogram
if none is registered. If aHistogram
was created, the providedMetadata
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 providedMetadata
object then an exception will be thrown.- Parameters:
metadata
- the name of the metric- Returns:
- a new or pre-existing
Histogram
-
histogram
Return theHistogram
registered under theMetricID
with theMetadata
's name and with the providedTag
s; or create and register a newHistogram
if none is registered. If aHistogram
was created, the providedMetadata
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 providedMetadata
object then an exception will be thrown.- Parameters:
metadata
- the name of the metrictags
- the tags of the metric- Returns:
- a new or pre-existing
Histogram
- Since:
- 2.0
-
timer
Return theTimer
registered under theMetricID
with this name and with no tags; or create and register a newTimer
if none is registered. If aTimer
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
name
- the name of the metric- Returns:
- a new or pre-existing
Timer
-
timer
Return theTimer
registered under theMetricID
with this name and with the providedTag
s; or create and register a newTimer
if none is registered. If aTimer
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
name
- the name of the metrictags
- the tags of the metric- Returns:
- a new or pre-existing
Timer
- Since:
- 2.0
-
timer
Return theTimer
registered under theMetricID
; or create and register a newTimer
if none is registered. If aTimer
was created, aMetadata
object will be registered with the name and type. If aMetadata
object is already registered with this metric name then thatMetadata
will be used.- Parameters:
metricID
- the ID of the metric- Returns:
- a new or pre-existing
Timer
- Since:
- 3.0
-
timer
Return theTimer
registered under the theMetricID
with theMetadata
's name and with no tags; or create and register a newTimer
if none is registered. If aTimer
was created, the providedMetadata
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 providedMetadata
object then an exception will be thrown.- Parameters:
metadata
- the name of the metric- Returns:
- a new or pre-existing
Timer
-
timer
Return theTimer
registered under the theMetricID
with theMetadata
's name and with the providedTag
s; or create and register a newTimer
if none is registered. If aTimer
was created, the providedMetadata
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 providedMetadata
object then an exception will be thrown.- Parameters:
metadata
- the name of the metrictags
- the tags of the metric- Returns:
- a new or pre-existing
Timer
- Since:
- 2.0
-
getMetric
-
getMetric
- Parameters:
metricID
- lookup key, notnull
asType
- the return type which is expected to be compatible with the actual type of the registered metric- Returns:
- the
Metric
registered for the providedMetricID
ornull
if none has been registered so far - Throws:
IllegalArgumentException
- If the registered metric was not assignable to the provided type- Since:
- 3.0
-
getCounter
- Parameters:
metricID
- lookup key, notnull
- Returns:
- the
Counter
registered for the key ornull
if none has been registered so far - Throws:
IllegalArgumentException
- If the registered metric was not assignable toCounter
- Since:
- 3.0
-
getGauge
- Parameters:
metricID
- lookup key, notnull
- Returns:
- the
Gauge
registered for the key ornull
if none has been registered so far - Throws:
IllegalArgumentException
- If the registered metric was not assignable toGauge
- Since:
- 3.0
-
getHistogram
- Parameters:
metricID
- lookup key, notnull
- Returns:
- the
Histogram
registered for the key ornull
if none has been registered so far - Throws:
IllegalArgumentException
- If the registered metric was not assignable toHistogram
- Since:
- 3.0
-
getTimer
- Parameters:
metricID
- lookup key, notnull
- Returns:
- the
Timer
registered for the key ornull
if none has been registered so far - Throws:
IllegalArgumentException
- If the registered metric was not assignable toTimer
- Since:
- 3.0
-
getMetadata
Return theMetadata
for the provided name.- Parameters:
name
- the name of the metric- Returns:
- the
Metadata
for the provided name ornull
if none has been registered for that name - Since:
- 3.0
-
remove
Removes all metrics with the given name.- Parameters:
name
- the name of the metric- Returns:
- whether or not the metric was removed
-
remove
Removes the metric with the given MetricID- Parameters:
metricID
- the MetricID of the metric- Returns:
- whether or not the metric was removed
- Since:
- 2.0
-
removeMatching
Removes all metrics which match the given filter.- Parameters:
filter
- a filter
-
getNames
Returns a set of the names of all the metrics in the registry.- Returns:
- the names of all the metrics
-
getMetricIDs
Returns a set of theMetricID
s of all the metrics in the registry.- Returns:
- the MetricIDs of all the metrics
-
getGauges
Returns a map of all the gauges in the registry and theirMetricID
s.- Returns:
- all the gauges in the registry
-
getGauges
Returns a map of all the gauges in the registry and theirMetricID
s which match the given filter.- Parameters:
filter
- the metric filter to match- Returns:
- all the gauges in the registry
-
getCounters
Returns a map of all the counters in the registry and theirMetricID
s.- Returns:
- all the counters in the registry
-
getCounters
Returns a map of all the counters in the registry and theirMetricID
s which match the given filter.- Parameters:
filter
- the metric filter to match- Returns:
- all the counters in the registry
-
getHistograms
Returns a map of all the histograms in the registry and theirMetricID
s.- Returns:
- all the histograms in the registry
-
getHistograms
Returns a map of all the histograms in the registry and theirMetricID
s which match the given filter.- Parameters:
filter
- the metric filter to match- Returns:
- all the histograms in the registry
-
getTimers
Returns a map of all the timers in the registry and theirMetricID
s.- Returns:
- all the timers in the registry
-
getTimers
Returns a map of all the timers in the registry and theirMetricID
s which match the given filter.- Parameters:
filter
- the metric filter to match- Returns:
- all the timers in the registry
-
getMetrics
Returns a map of all the metrics in the registry and theirMetricID
s which match the given filter.- Parameters:
filter
- the metric filter to match- Returns:
- all the metrics in the registry
- Since:
- 3.0
-
getMetrics
Returns a map of all the metrics in the registry and theirMetricID
s which match the given filter and which are assignable to the provided type.- Parameters:
ofType
- the type to which all returned metrics should be assignablefilter
- the metric filter to match- Returns:
- all the metrics in the registry
- Since:
- 3.0
-
getMetrics
Returns a map of all the metrics in the registry and theirMetricID
s at query time. The only guarantee about this method is that any key has a value (compared to usinggetMetric(MetricID)
andgetMetricIDs()
together). It is only intended for bulk querying, if you need a single or a few entries, always prefergetMetric(MetricID)
orgetMetrics(MetricFilter)
.- Returns:
- all the metrics in the registry
-
getMetadata
Returns a map of all the metadata in the registry and their names. The only guarantee about this method is that any key has a value (compared to usinggetMetadata(String)
. It is only intended for bulk querying, if you need a single or a few metadata, always prefergetMetadata(String)
}.- Returns:
- all the metadata in the registry
-
getScope
String getScope()Returns the scope of this metric registry.- Returns:
- Scope of this registry (VENDOR_SCOPE, BASE_SCOPE, APPLICATION_SCOPE, or a custom scope)
-
APPLICATION_SCOPE
,BASE_SCOPE
orVENDOR_SCOPE
withRegistryScope
instead.