Package org.eclipse.microprofile.metrics
Class MetricRegistry
java.lang.Object
org.eclipse.microprofile.metrics.MetricRegistry
The registry that stores metrics and their metadata.
The MetricRegistry provides methods to register, create and retrieve metrics and their respective metadata.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration representing the scopes of the MetricRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Counterabstract CounterReturns a map of all the counters in the registry and their names.getCounters(MetricFilter filter) Returns a map of all the counters in the registry and their names which match the given filter.Returns a map of all the gauges in the registry and their names.getGauges(MetricFilter filter) Returns a map of all the gauges in the registry and their names which match the given filter.Returns a map of all the histograms in the registry and their names.getHistograms(MetricFilter filter) Returns a map of all the histograms in the registry and their names which match the given filter.Returns a map of all the metadata in the registry and their names.Returns a map of all the meters in the registry and their names.getMeters(MetricFilter filter) Returns a map of all the meters in the registry and their names which match the given filter.Returns a map of all the metrics in the registry and their names.getNames()Returns a set of the names of all the metrics in the registry.Returns a map of all the timers in the registry and their names.getTimers(MetricFilter filter) Returns a map of all the timers in the registry and their names which match the given filter.abstract Histogramabstract Histogramabstract Meterabstract Meterstatic StringConcatenates a class name and elements to form a dotted name, eliding any null values or empty strings.static StringConcatenates elements to form a dotted name, eliding any null values or empty strings.abstract <T extends Metric>
TGiven aMetric, registers it under the given name.abstract <T extends Metric>
Tabstract booleanRemoves the metric with the given name.abstract voidremoveMatching(MetricFilter filter) Removes all metrics which match the given filter.abstract Timerabstract Timer
-
Constructor Details
-
MetricRegistry
public MetricRegistry()
-
-
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:
nameandnamesconcatenated 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:
klassandnamesconcatenated by periods
-
register
public abstract <T extends Metric> T register(String name, T metric) throws IllegalArgumentException Given aMetric, registers it under the given name. AMetadataobject will be registered with the name and type.- Type Parameters:
T- the type of the metric- Parameters:
name- the name of the metricmetric- the metric- Returns:
metric- Throws:
IllegalArgumentException- if the name is already registered
-
register
public abstract <T extends Metric> T register(String name, T metric, Metadata metadata) throws IllegalArgumentException - Type Parameters:
T- the type of the metric- Parameters:
name- the name of the metricmetric- the metricmetadata- the metadata- Returns:
metric- Throws:
IllegalArgumentException- if the name is already registered
-
counter
Return theCounterregistered under this name; or create and register a newCounterif none is registered. If aCounterwas created, aMetadataobject will be registered with the name and type.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Counter
-
counter
Return theCounterregistered under theMetadata's name; or create and register a newCounterif none is registered. If aCounterwas created, the providedMetadataobject will be registered.Note: The
Metadatawill not be updated if the metric is already registered.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Counter
-
histogram
Return theHistogramregistered under this name; or create and register a newHistogramif none is registered. If aHistogramwas created, aMetadataobject will be registered with the name and type.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Histogram
-
histogram
Return theHistogramregistered under theMetadata's name; or create and register a newHistogramif none is registered. If aHistogramwas created, the providedMetadataobject will be registered.Note: The
Metadatawill not be updated if the metric is already registered.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Histogram
-
meter
Return theMeterregistered under this name; or create and register a newMeterif none is registered. If aMeterwas created, aMetadataobject will be registered with the name and type.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Meter
-
meter
Return theMeterregistered under theMetadata's name; or create and register a newMeterif none is registered. If aMeterwas created, the providedMetadataobject will be registered.Note: The
Metadatawill not be updated if the metric is already registered.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Meter
-
timer
Return theTimerregistered under this name; or create and register a newTimerif none is registered. If aTimerwas created, aMetadataobject will be registered with the name and type.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Timer
-
timer
Return theTimerregistered under theMetadata's name; or create and register a newTimerif none is registered. If aTimerwas created, the providedMetadataobject will be registered.Note: The
Metadatawill not be updated if the metric is already registered.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Timer
-
remove
Removes the metric with the given name.- Parameters:
name- the name of the metric- Returns:
- whether or not the metric was removed
-
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
-
getGauges
Returns a map of all the gauges in the registry and their names.- Returns:
- all the gauges in the registry
-
getGauges
Returns a map of all the gauges in the registry and their names 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 their names.- Returns:
- all the counters in the registry
-
getCounters
Returns a map of all the counters in the registry and their names 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 their names.- Returns:
- all the histograms in the registry
-
getHistograms
Returns a map of all the histograms in the registry and their names which match the given filter.- Parameters:
filter- the metric filter to match- Returns:
- all the histograms in the registry
-
getMeters
Returns a map of all the meters in the registry and their names.- Returns:
- all the meters in the registry
-
getMeters
Returns a map of all the meters in the registry and their names which match the given filter.- Parameters:
filter- the metric filter to match- Returns:
- all the meters in the registry
-
getTimers
Returns a map of all the timers in the registry and their names.- Returns:
- all the timers in the registry
-
getTimers
Returns a map of all the timers in the registry and their names 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 their names.- Returns:
- all the metrics in the registry
-
getMetadata
Returns a map of all the metadata in the registry and their names.- Returns:
- all the metadata in the registry
-