Class MetricRegistry
- 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 ConcurrentGaugeconcurrentGauge(String name) Return theConcurrentGaugeregistered under theMetricIDwith this name; or create and register a newConcurrentGaugeif none is registered.abstract ConcurrentGaugeconcurrentGauge(String name, Tag... tags) Return theConcurrentGaugeregistered under theMetricIDwith this name and with the providedTags; or create and register a newConcurrentGaugeif none is registered.abstract ConcurrentGaugeconcurrentGauge(Metadata metadata) Return theConcurrentGaugeregistered under theMetricIDwith theMetadata's name; or create and register a newConcurrentGaugeif none is registered.abstract ConcurrentGaugeconcurrentGauge(Metadata metadata, Tag... tags) Return theConcurrentGaugeregistered under theMetricIDwith theMetadata's name and with the providedTags; or create and register a newConcurrentGaugeif none is registered.abstract Counterabstract Counterabstract Counterabstract Counterabstract SortedMap<MetricID,ConcurrentGauge> Returns a map of all the concurrent gauges in the registry and theirMetricIDs.abstract SortedMap<MetricID,ConcurrentGauge> getConcurrentGauges(MetricFilter filter) Returns a map of all the concurrent gauges in the registry and theirMetricIDs which match the given filter.Returns a map of all the counters in the registry and theirMetricIDs.getCounters(MetricFilter filter) Returns a map of all the counters in the registry and theirMetricIDs which match the given filter.Returns a map of all the gauges in the registry and theirMetricIDs.getGauges(MetricFilter filter) Returns a map of all the gauges in the registry and theirMetricIDs which match the given filter.Returns a map of all the histograms in the registry and theirMetricIDs.getHistograms(MetricFilter filter) Returns a map of all the histograms in the registry and theirMetricIDs 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 theirMetricIDs.getMeters(MetricFilter filter) Returns a map of all the meters in the registry and theirMetricIDs which match the given filter.Returns a set of theMetricIDs of all the metrics in the registry.Returns a map of all the metrics in the registry and theirMetricIDs.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 theirMetricIDs.getTimers(MetricFilter filter) Returns a map of all the timers in the registry and theirMetricIDs which match the given filter.abstract Histogramabstract Histogramabstract Histogramabstract Histogramabstract Meterabstract Meterabstract 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>
Tabstract <T extends Metric>
Tabstract <T extends Metric>
Tabstract booleanRemoves all metrics with the given name.abstract booleanRemoves the metric with the given MetricIDabstract voidremoveMatching(MetricFilter filter) Removes all metrics which match the given filter.abstract Timerabstract Timerabstract 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 aMetricIDwith the given name and with no tags. AMetadataobject will be registered with the name and type. However, if aMetadataobject is already registered with this metric name and is not equal to the createdMetadataobject then an exception will be thrown.- 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 or if Metadata with different values has already been registered with the name
-
register
public abstract <T extends Metric> T register(Metadata metadata, T metric) throws IllegalArgumentException Given aMetricandMetadata, registers the metric with aMetricIDwith the name provided by theMetadataand with no tags.Note: If a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Type Parameters:
T- the type of the metric- Parameters:
metadata- the metadatametric- the metric- Returns:
metric- Throws:
IllegalArgumentException- if the name is already registered or if Metadata with different values has already been registered with the name- Since:
- 1.1
-
register
public abstract <T extends Metric> T register(Metadata metadata, T metric, Tag... tags) throws IllegalArgumentException Given aMetricandMetadata, registers both under aMetricIDwith the name provided by theMetadataand with the providedTags.Note: If a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Type Parameters:
T- the type of the metric- Parameters:
metadata- the metadatametric- the metrictags- the tags of the metric- Returns:
metric- Throws:
IllegalArgumentException- if the name is already registered or if Metadata with different values has already been registered with the name- Since:
- 2.0
-
counter
Return theCounterregistered under theMetricIDwith this name and with no tags; or create and register a newCounterif none is registered. If aCounterwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill be used.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Counter
-
counter
Return theCounterregistered under theMetricIDwith this name and with the providedTags; or create and register a newCounterif none is registered. If aCounterwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill 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 theCounterregistered under theMetricIDwith theMetadata's name and with no tags; or create and register a newCounterif none is registered. If aCounterwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Counter
-
counter
Return theCounterregistered under theMetricIDwith theMetadata's name and with the providedTags; or create and register a newCounterif none is registered. If aCounterwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject 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
-
concurrentGauge
Return theConcurrentGaugeregistered under theMetricIDwith this name; or create and register a newConcurrentGaugeif none is registered. If aConcurrentGaugewas created, aMetadataobject will be registered with the name and type.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
ConcurrentGauge
-
concurrentGauge
Return theConcurrentGaugeregistered under theMetricIDwith this name and with the providedTags; or create and register a newConcurrentGaugeif none is registered. If aConcurrentGaugewas created, aMetadataobject will be registered with the name and type.- Parameters:
name- the name of the metrictags- the tags of the metric- Returns:
- a new or pre-existing
ConcurrentGauge
-
concurrentGauge
Return theConcurrentGaugeregistered under theMetricIDwith theMetadata's name; or create and register a newConcurrentGaugeif none is registered. If aConcurrentGaugewas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
ConcurrentGauge
-
concurrentGauge
Return theConcurrentGaugeregistered under theMetricIDwith theMetadata's name and with the providedTags; or create and register a newConcurrentGaugeif none is registered. If aConcurrentGaugewas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Parameters:
metadata- the name of the metrictags- the tags of the metric- Returns:
- a new or pre-existing
ConcurrentGauge
-
histogram
Return theHistogramregistered under theMetricIDwith this name and with no tags; or create and register a newHistogramif none is registered. If aHistogramwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill be used.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Histogram
-
histogram
Return theHistogramregistered under theMetricIDwith this name and with the providedTags; or create and register a newHistogramif none is registered. If aHistogramwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill 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 theHistogramregistered under theMetricIDwith theMetadata's name and with no tags; or create and register a newHistogramif none is registered. If aHistogramwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Histogram
-
histogram
Return theHistogramregistered under theMetricIDwith theMetadata's name and with the providedTags; or create and register a newHistogramif none is registered. If aHistogramwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject 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
-
meter
Return theMeterregistered under theMetricIDwith this name and with no tags; or create and register a newMeterif none is registered. If aMeterwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill be used.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Meter
-
meter
Return theMeterregistered under theMetricIDwith this name and with the providedTags; or create and register a newMeterif none is registered. If aMeterwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill be used.- Parameters:
name- the name of the metrictags- the tags of the metric- Returns:
- a new or pre-existing
Meter - Since:
- 2.0
-
meter
Return theMeterregistered under theMetricIDwith theMetadata's name and with no tags; or create and register a newMeterif none is registered. If aMeterwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Meter
-
meter
Return theMeterregistered under theMetricIDwith theMetadata's name and with the providedTags; or create and register a newMeterif none is registered. If aMeterwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Parameters:
metadata- the name of the metrictags- the tags of the metric- Returns:
- a new or pre-existing
Meter - Since:
- 2.0
-
timer
Return theTimerregistered under theMetricIDwith this name and with no tags; or create and register a newTimerif none is registered. If aTimerwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill be used.- Parameters:
name- the name of the metric- Returns:
- a new or pre-existing
Timer
-
timer
Return theTimerregistered under theMetricIDwith this name and with the providedTags; or create and register a newTimerif none is registered. If aTimerwas created, aMetadataobject will be registered with the name and type. If aMetadataobject is already registered with this metric name then thatMetadatawill 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 theTimerregistered under the theMetricIDwith theMetadata's name and with no tags; or create and register a newTimerif none is registered. If aTimerwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject then an exception will be thrown.- Parameters:
metadata- the name of the metric- Returns:
- a new or pre-existing
Timer
-
timer
Return theTimerregistered under the theMetricIDwith theMetadata's name and with the providedTags; or create and register a newTimerif none is registered. If aTimerwas created, the providedMetadataobject will be registered.Note: During retrieval or creation, if a
Metadataobject is already registered under this metric name and is not equal to the providedMetadataobject 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
-
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 theMetricIDs 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 theirMetricIDs.- Returns:
- all the gauges in the registry
-
getGauges
Returns a map of all the gauges in the registry and theirMetricIDs 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 theirMetricIDs.- Returns:
- all the counters in the registry
-
getCounters
Returns a map of all the counters in the registry and theirMetricIDs which match the given filter.- Parameters:
filter- the metric filter to match- Returns:
- all the counters in the registry
-
getConcurrentGauges
Returns a map of all the concurrent gauges in the registry and theirMetricIDs.- Returns:
- all the concurrent gauges in the registry
-
getConcurrentGauges
Returns a map of all the concurrent gauges in the registry and theirMetricIDs which match the given filter.- Parameters:
filter- the metric filter to match- Returns:
- all the concurrent gauges in the registry
-
getHistograms
Returns a map of all the histograms in the registry and theirMetricIDs.- Returns:
- all the histograms in the registry
-
getHistograms
Returns a map of all the histograms in the registry and theirMetricIDs 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 theirMetricIDs.- Returns:
- all the meters in the registry
-
getMeters
Returns a map of all the meters in the registry and theirMetricIDs 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 theirMetricIDs.- Returns:
- all the timers in the registry
-
getTimers
Returns a map of all the timers in the registry and theirMetricIDs 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 theirMetricIDs.- 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
-