Top Description Inners Fields Methods
org.eclipse.microprofile.metrics

public Interface MetricRegistry

Static Imports
java.util.Arrays.asList, java.util.stream.Collectors.joining

The registry that stores metrics and their metadata. The MetricRegistry provides methods to register, create and retrieve metrics and their respective metadata.
See Also
MetricFilter

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
MetricRegistry.Type

An enumeration representing the provided scopes of the MetricRegistry.

Field Summary

Modifier and TypeField and Description
public static final String
APPLICATION_SCOPE

String constant to represent the scope value used for the application scope

public static final String
BASE_SCOPE

String constant to represent the scope value used for the base scope

public static final String
VENDOR_SCOPE

String constant to represent the scope value used for the vendor scope

Method Summary

Modifier and TypeMethod and Description
public Counter

Returns:

a new or pre-existing Counter
counter
(String
the name of the metric
name
)

Return the Counter registered under the MetricID with this name and with no tags; or create and register a new Counter if none is registered.

public Counter

Returns:

a new or pre-existing Counter
counter
(String
the name of the metric
name
,
Tag...
the tags of the metric
tags
)

Return the Counter registered under the MetricID with this name and with the provided Tags; or create and register a new Counter if none is registered.

public Counter

Returns:

a new or pre-existing Counter
counter
(MetricID
the ID of the metric
metricID
)

Return the Counter registered under the MetricID; or create and register a new Counter if none is registered.

public Counter

Returns:

a new or pre-existing Counter
counter
(Metadata
the name of the metric
metadata
)

Return the 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.

public Counter

Returns:

a new or pre-existing Counter
counter
(Metadata
the name of the metric
metadata
,
Tag...
the tags of the metric
tags
)

Return the Counter registered under the MetricID with the Metadata's name and with the provided Tags; or create and register a new Counter if none is registered.

public <
The Type of the Object of which the function func is applied to
T
, R extends Number>
Gauge<R>

Returns:

a new or pre-existing Gauge
gauge
(String
The name of the Gauge metric
name
,
T
The object that the Function func will be applied to
object
,
Function<T, R>
The Function that will be applied to object
func
,
Tag...
The tags of the metric
tags
)

Return the Gauge of type Number registered under the MetricID with this name and with the provided Tags; or create and register this gauge if none is registered.

public <
The Type of the Object of which the function func is applied to
T
, R extends Number>
Gauge<R>

Returns:

a new or pre-existing Gauge
gauge
(MetricID
The MetricID of the Gauge metric
metricID
,
T
The object that the Function func will be applied to
object
,
Function<T, R>
The Function that will be applied to object
func
)

Return the Gauge of type Number registered under the MetricID; or create and register this gauge if none is registered.

public <
The Type of the Object of which the function func is applied to
T
, R extends Number>
Gauge<R>

Returns:

a new or pre-existing Gauge
gauge
(Metadata
The Metadata of the Gauge
metadata
,
T
The object that the Function func will be applied to
object
,
Function<T, R>
The Function that will be applied to object
func
,
Tag...
The tags of the metric
tags
)

Return the Gauge of type Number registered under the MetricID with the @{link Metadata}'s name and with the provided Tags; or create and register this gauge if none is registered.

public <T extends Number> Gauge<T>

Returns:

a new or pre-existing Gauge
gauge
(String
The name of the Gauge
name
,
Supplier<T>
The Supplier function that will return the value for the Gauge metric
supplier
,
Tag...
The tags of the metric
tags
)

Return the Gauge registered under the MetricID with this name and with the provided Tags; or create and register this gauge if none is registered.

public <T extends Number> Gauge<T>

Returns:

a new or pre-existing Gauge
gauge
(MetricID metricID, Supplier<T>
The Supplier function that will return the value for the Gauge metric
supplier
)

Return the Gauge registered under the MetricID; or create and register this gauge if none is registered.

public <T extends Number> Gauge<T>

Returns:

a new or pre-existing Gauge
gauge
(Metadata
The metadata of the gauge
metadata
,
Supplier<T>
The Supplier function that will return the value for the Gauge metric
supplier
,
Tag...
The tags of the metric
tags
)

Return the Gauge registered under the MetricID with the @{link Metadata}'s name and with the provided Tags; or create and register this gauge if none is registered.

public Counter

Returns:

the Counter registered for the key or null if none has been registered so far
getCounter
(MetricID
lookup key, not null
metricID
)

Return the Counter registered for the provided MetricID.

public SortedMap<MetricID, Counter>

Returns:

all the counters in the registry
getCounters
()

Returns a map of all the counters in the registry and their MetricIDs.

public SortedMap<MetricID, Counter>

Returns:

all the counters in the registry
getCounters
(MetricFilter
the metric filter to match
filter
)

Returns a map of all the counters in the registry and their MetricIDs which match the given filter.

public Gauge<?>

Returns:

the Gauge registered for the key or null if none has been registered so far
getGauge
(MetricID
lookup key, not null
metricID
)

Return the Gauge registered for the provided MetricID.

public SortedMap<MetricID, Gauge<T extends Number>>

Returns:

all the gauges in the registry
getGauges
()

Returns a map of all the gauges in the registry and their MetricIDs.

public SortedMap<MetricID, Gauge<T extends Number>>

Returns:

all the gauges in the registry
getGauges
(MetricFilter
the metric filter to match
filter
)

Returns a map of all the gauges in the registry and their MetricIDs which match the given filter.

public Histogram

Returns:

the Histogram registered for the key or null if none has been registered so far
getHistogram
(MetricID
lookup key, not null
metricID
)

Return the Histogram registered for the provided MetricID.

public SortedMap<MetricID, Histogram>

Returns:

all the histograms in the registry
getHistograms
()

Returns a map of all the histograms in the registry and their MetricIDs.

public SortedMap<MetricID, Histogram>

Returns:

all the histograms in the registry
getHistograms
(MetricFilter
the metric filter to match
filter
)

Returns a map of all the histograms in the registry and their MetricIDs which match the given filter.

public Metadata

Returns:

the Metadata for the provided name or null if none has been registered for that name
getMetadata
(String
the name of the metric
name
)

Return the Metadata for the provided name.

public Map<String, Metadata>

Returns:

all the metadata in the registry
getMetadata
()

Returns a map of all the metadata in the registry and their names.

public Metric

Returns:

the Metric registered for the provided MetricID or null if none has been registered so far
getMetric
(MetricID
lookup key, not null
metricID
)

Return the Metric registered for a provided MetricID.

public <T extends Metric> T

Returns:

the Metric registered for the provided MetricID or null if none has been registered so far
getMetric
(MetricID
lookup key, not null
metricID
,
Class<T>
the return type which is expected to be compatible with the actual type of the registered metric
asType
)

Return the Metric registered for the provided MetricID as the provided type.

public SortedSet<MetricID>

Returns:

the MetricIDs of all the metrics
getMetricIDs
()

Returns a set of the MetricIDs of all the metrics in the registry.

public SortedMap<MetricID, Metric>

Returns:

all the metrics in the registry
getMetrics
(MetricFilter
the metric filter to match
filter
)

Returns a map of all the metrics in the registry and their MetricIDs which match the given filter.

public <T extends Metric> SortedMap<MetricID, T>

Returns:

all the metrics in the registry
getMetrics
(Class<T>
the type to which all returned metrics should be assignable
ofType
,
MetricFilter
the metric filter to match
filter
)

Returns a map of all the metrics in the registry and their MetricIDs which match the given filter and which are assignable to the provided type.

public Map<MetricID, Metric>

Returns:

all the metrics in the registry
getMetrics
()

Returns a map of all the metrics in the registry and their MetricIDs at query time.

public SortedSet<String>

Returns:

the names of all the metrics
getNames
()

Returns a set of the names of all the metrics in the registry.

public String

Returns:

Scope of this registry (VENDOR_SCOPE, BASE_SCOPE, APPLICATION_SCOPE, or a custom scope)
getScope
()

Returns the scope of this metric registry.

public Timer

Returns:

the Timer registered for the key or null if none has been registered so far
getTimer
(MetricID
lookup key, not null
metricID
)

Return the Timer registered for the provided MetricID.

public SortedMap<MetricID, Timer>

Returns:

all the timers in the registry
getTimers
()

Returns a map of all the timers in the registry and their MetricIDs.

public SortedMap<MetricID, Timer>

Returns:

all the timers in the registry
getTimers
(MetricFilter
the metric filter to match
filter
)

Returns a map of all the timers in the registry and their MetricIDs which match the given filter.

public Histogram

Returns:

a new or pre-existing Histogram
histogram
(String
the name of the metric
name
)

Return the Histogram registered under the MetricID with this name and with no tags; or create and register a new Histogram if none is registered.

public Histogram

Returns:

a new or pre-existing Histogram
histogram
(String
the name of the metric
name
,
Tag...
the tags of the metric
tags
)

Return the Histogram registered under the MetricID with this name and with the provided Tags; or create and register a new Histogram if none is registered.

public Histogram

Returns:

a new or pre-existing Histogram
histogram
(MetricID
the ID of the metric
metricID
)

Return the Histogram registered under the MetricID; or create and register a new Histogram if none is registered.

public Histogram

Returns:

a new or pre-existing Histogram
histogram
(Metadata
the name of the metric
metadata
)

Return the 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.

public Histogram

Returns:

a new or pre-existing Histogram
histogram
(Metadata
the name of the metric
metadata
,
Tag...
the tags of the metric
tags
)

Return the Histogram registered under the MetricID with the Metadata's name and with the provided Tags; or create and register a new Histogram if none is registered.

public static String

Returns:

name and names concatenated by periods
name
(String
the first element of the name
name
,
String...
the remaining elements of the name
names
)

Concatenates elements to form a dotted name, eliding any null values or empty strings.

public static String

Returns:

klass and names concatenated by periods
name
(Class<?>
the first element of the name
klass
,
String...
the remaining elements of the name
names
)

Concatenates a class name and elements to form a dotted name, eliding any null values or empty strings.

public boolean

Returns:

whether or not the metric was removed
remove
(String
the name of the metric
name
)

Removes all metrics with the given name.

public boolean

Returns:

whether or not the metric was removed
remove
(MetricID
the MetricID of the metric
metricID
)

Removes the metric with the given MetricID

public void
removeMatching(MetricFilter
a filter
filter
)

Removes all metrics which match the given filter.

public Timer

Returns:

a new or pre-existing Timer
timer
(String
the name of the metric
name
)

Return the Timer registered under the MetricID with this name and with no tags; or create and register a new Timer if none is registered.

public Timer

Returns:

a new or pre-existing Timer
timer
(String
the name of the metric
name
,
Tag...
the tags of the metric
tags
)

Return the Timer registered under the MetricID with this name and with the provided Tags; or create and register a new Timer if none is registered.

public Timer

Returns:

a new or pre-existing Timer
timer
(MetricID
the ID of the metric
metricID
)

Return the Timer registered under the MetricID; or create and register a new Timer if none is registered.

public Timer

Returns:

a new or pre-existing Timer
timer
(Metadata
the name of the metric
metadata
)

Return the 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.

public Timer

Returns:

a new or pre-existing Timer
timer
(Metadata
the name of the metric
metadata
,
Tag...
the tags of the metric
tags
)

Return the Timer registered under the the MetricID with the Metadata's name and with the provided Tags; or create and register a new Timer if none is registered.