Package io.helidon.metrics
Class Registry
- java.lang.Object
-
- org.eclipse.microprofile.metrics.MetricRegistry
-
- io.helidon.metrics.Registry
-
- All Implemented Interfaces:
io.helidon.common.metrics.InternalBridge.MetricRegistry
public class Registry extends MetricRegistry implements io.helidon.common.metrics.InternalBridge.MetricRegistry
Metrics registry.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.microprofile.metrics.MetricRegistry
MetricRegistry.Type
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRegistry(MetricRegistry.Type type)Create a registry of a certain type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConcurrentGaugeconcurrentGauge(String name)ConcurrentGaugeconcurrentGauge(String name, Tag... tags)ConcurrentGaugeconcurrentGauge(Metadata metadata)ConcurrentGaugeconcurrentGauge(Metadata metadata, Tag... tags)Countercounter(io.helidon.common.metrics.InternalBridge.Metadata metadata)Finds or creates a newCounterusing the specified version-neutralMetadata.Countercounter(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)Finds or creates a new Counter using the specified version-neutralMetadataand version-neutralTags.Countercounter(String name)Finds or creates a newCounterusing the specified name.Countercounter(String name, Tag... tags)Countercounter(Metadata metadata)Countercounter(Metadata metadata, Tag... tags)static Registrycreate(MetricRegistry.Type type)Create a registry of a certain type.booleanempty()Determines if registry is empty.SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Counter>getBridgeCounters()Returns allCountermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Gauge>getBridgeGauges()Returns allGaugemetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Histogram>getBridgeHistograms()Returns allHistogrammetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Meter>getBridgeMeters()Returns allMetermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.Optional<Map.Entry<? extends io.helidon.common.metrics.InternalBridge.MetricID,? extends Metric>>getBridgeMetric(String metricName)Map<io.helidon.common.metrics.InternalBridge.MetricID,Metric>getBridgeMetrics()Returns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics.Map<io.helidon.common.metrics.InternalBridge.MetricID,Metric>getBridgeMetrics(Predicate<? super Map.Entry<? extends io.helidon.common.metrics.InternalBridge.MetricID,? extends Metric>> predicate)Returns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics, filtered by the providedPredicate.SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Timer>getBridgeTimers()Returns allTimermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedMap<MetricID,ConcurrentGauge>getConcurrentGauges()SortedMap<MetricID,ConcurrentGauge>getConcurrentGauges(MetricFilter filter)SortedMap<MetricID,Counter>getCounters()SortedMap<MetricID,Counter>getCounters(MetricFilter filter)SortedMap<MetricID,Gauge>getGauges()SortedMap<MetricID,Gauge>getGauges(MetricFilter filter)SortedMap<MetricID,Histogram>getHistograms()SortedMap<MetricID,Histogram>getHistograms(MetricFilter filter)Map<String,Metadata>getMetadata()SortedMap<MetricID,Meter>getMeters()SortedMap<MetricID,Meter>getMeters(MetricFilter filter)Optional<Metric>getMetric(String metricName)Access a metric by name.SortedSet<MetricID>getMetricIDs()Map<MetricID,Metric>getMetrics()SortedSet<String>getNames()Returns the names of all metrics in the registry.Optional<Map.Entry<? extends Metric,List<MetricID>>>getOptionalMetricWithIDsEntry(String metricName)Get internal map entry given a metric name.SortedMap<MetricID,Timer>getTimers()SortedMap<MetricID,Timer>getTimers(MetricFilter filter)Histogramhistogram(io.helidon.common.metrics.InternalBridge.Metadata metadata)Finds or creates a newHistogramusing the specified version-neutralMetadata.Histogramhistogram(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)Finds or creates a newHistogramusing the specified version-neutralMetadataand version-neutralTags.Histogramhistogram(String name)Finds or creates a newHistogramusing the specifiedMetadata.Histogramhistogram(String name, Tag... tags)Histogramhistogram(Metadata metadata)Histogramhistogram(Metadata metadata, Tag... tags)Metermeter(io.helidon.common.metrics.InternalBridge.Metadata metadata)Finds or creates a newMeterusing the specified version-neutralMetadata.Metermeter(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)Finds or creates a newMeterusing the specified version-neutralMetadataand version-neutralTags.Metermeter(String name)Finds or creates a newMeterusing the specified name.Metermeter(String name, Tag... tags)Metermeter(Metadata metadata)Metermeter(Metadata metadata, Tag... tags)<T extends Metric>
Tregister(io.helidon.common.metrics.InternalBridge.Metadata metadata, T metric)Registers a new metric using the specified version-neutralInternalBridge.Metadataand the typed metric itself.<T extends Metric>
Tregister(io.helidon.common.metrics.InternalBridge.MetricID metricID, T metric)Registers a new metric using the specified version-neutralInternalBridge.MetricIDand the typed metric itself.<T extends Metric>
Tregister(String name, T metric)<T extends Metric>
Tregister(Metadata metadata, T metric)<T extends Metric>
Tregister(Metadata metadata, T metric, Tag... tags)booleanremove(String name)Removes a metric by name.booleanremove(MetricID metricID)Removes a metric by ID.voidremoveMatching(MetricFilter filter)Timertimer(io.helidon.common.metrics.InternalBridge.Metadata metadata)Finds or creates a newTimerusing the specified version-neutralMetadata.Timertimer(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)Finds or creates a newTimerusing the specified version-neutralMetadataand version-neutralTags.Timertimer(String name)Finds or creates a newTimerusing the specified name.Timertimer(String name, Tag... tags)Timertimer(Metadata metadata)Timertimer(Metadata metadata, Tag... tags)StringtoString()Stringtype()Returns type of this registry.-
Methods inherited from class org.eclipse.microprofile.metrics.MetricRegistry
name, name
-
-
-
-
Constructor Detail
-
Registry
protected Registry(MetricRegistry.Type type)
Create a registry of a certain type.- Parameters:
type- Registry type.
-
-
Method Detail
-
create
public static Registry create(MetricRegistry.Type type)
Create a registry of a certain type.- Parameters:
type- Registry type.- Returns:
- The newly created registry.
-
register
public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException
- Specified by:
registerin classMetricRegistry- Throws:
IllegalArgumentException
-
register
public <T extends Metric> T register(Metadata metadata, T metric) throws IllegalArgumentException
- Specified by:
registerin classMetricRegistry- Throws:
IllegalArgumentException
-
register
public <T extends Metric> T register(Metadata metadata, T metric, Tag... tags) throws IllegalArgumentException
- Specified by:
registerin classMetricRegistry- Throws:
IllegalArgumentException
-
counter
public Counter counter(String name)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newCounterusing the specified name.- Specified by:
counterin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Specified by:
counterin classMetricRegistry- Parameters:
name- name for the newCounter- Returns:
- the
Counter
-
counter
public Counter counter(Metadata metadata)
- Specified by:
counterin classMetricRegistry
-
counter
public Counter counter(io.helidon.common.metrics.InternalBridge.Metadata metadata)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newCounterusing the specified version-neutralMetadata.- Specified by:
counterin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the counter- Returns:
- the
Counter
-
counter
public Counter counter(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a new Counter using the specified version-neutralMetadataand version-neutralTags.- Specified by:
counterin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the countertags- used in locating and, if needed, building the counter- Returns:
- the
Counter
-
counter
public Counter counter(String name, Tag... tags)
- Specified by:
counterin classMetricRegistry
-
counter
public Counter counter(Metadata metadata, Tag... tags)
- Specified by:
counterin classMetricRegistry
-
histogram
public Histogram histogram(String name)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newHistogramusing the specifiedMetadata.- Specified by:
histogramin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Specified by:
histogramin classMetricRegistry- Parameters:
name- used in locating and, if needed, building the histogram- Returns:
- the
Histogram
-
histogram
public Histogram histogram(Metadata metadata)
- Specified by:
histogramin classMetricRegistry
-
histogram
public Histogram histogram(io.helidon.common.metrics.InternalBridge.Metadata metadata)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newHistogramusing the specified version-neutralMetadata.- Specified by:
histogramin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the histogram- Returns:
- the
Histogram
-
histogram
public Histogram histogram(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newHistogramusing the specified version-neutralMetadataand version-neutralTags.- Specified by:
histogramin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the histogramtags- used in locating and, if needed, building the histogram- Returns:
- the
Histogram
-
histogram
public Histogram histogram(String name, Tag... tags)
- Specified by:
histogramin classMetricRegistry
-
histogram
public Histogram histogram(Metadata metadata, Tag... tags)
- Specified by:
histogramin classMetricRegistry
-
meter
public Meter meter(String name)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newMeterusing the specified name.- Specified by:
meterin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Specified by:
meterin classMetricRegistry- Parameters:
name- used in locating and, if needed, building the meter- Returns:
- the
Meter
-
meter
public Meter meter(Metadata metadata)
- Specified by:
meterin classMetricRegistry
-
meter
public Meter meter(io.helidon.common.metrics.InternalBridge.Metadata metadata)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newMeterusing the specified version-neutralMetadata.- Specified by:
meterin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the meter- Returns:
- the
Meter
-
meter
public Meter meter(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newMeterusing the specified version-neutralMetadataand version-neutralTags.- Specified by:
meterin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the metertags- used in locating and, if needed, building the meter- Returns:
- the
Meter
-
meter
public Meter meter(String name, Tag... tags)
- Specified by:
meterin classMetricRegistry
-
meter
public Meter meter(Metadata metadata, Tag... tags)
- Specified by:
meterin classMetricRegistry
-
timer
public Timer timer(String name)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newTimerusing the specified name.- Specified by:
timerin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Specified by:
timerin classMetricRegistry- Parameters:
name- used in locating and, if needed, building the timer- Returns:
- the
Timer
-
timer
public Timer timer(Metadata metadata)
- Specified by:
timerin classMetricRegistry
-
timer
public Timer timer(io.helidon.common.metrics.InternalBridge.Metadata metadata)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newTimerusing the specified version-neutralMetadata.- Specified by:
timerin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the timer- Returns:
- the
Timer
-
timer
public Timer timer(io.helidon.common.metrics.InternalBridge.Metadata metadata, Map<String,String> tags)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryFinds or creates a newTimerusing the specified version-neutralMetadataand version-neutralTags.- Specified by:
timerin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metadata- used in locating and, if needed, building the timertags- used in locationg and, if needed, building the timer- Returns:
- the
Timer
-
timer
public Timer timer(String name, Tag... tags)
- Specified by:
timerin classMetricRegistry
-
timer
public Timer timer(Metadata metadata, Tag... tags)
- Specified by:
timerin classMetricRegistry
-
concurrentGauge
public ConcurrentGauge concurrentGauge(String name)
- Specified by:
concurrentGaugein classMetricRegistry
-
concurrentGauge
public ConcurrentGauge concurrentGauge(Metadata metadata)
- Specified by:
concurrentGaugein classMetricRegistry
-
concurrentGauge
public ConcurrentGauge concurrentGauge(String name, Tag... tags)
- Specified by:
concurrentGaugein classMetricRegistry
-
concurrentGauge
public ConcurrentGauge concurrentGauge(Metadata metadata, Tag... tags)
- Specified by:
concurrentGaugein classMetricRegistry
-
remove
public boolean remove(String name)
Removes a metric by name. Synchronized for atomic update of more than one internal map.- Specified by:
removein interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Specified by:
removein classMetricRegistry- Parameters:
name- Name of the metric.- Returns:
- Outcome of removal.
-
remove
public boolean remove(MetricID metricID)
Removes a metric by ID. Synchronized for atomic update of more than one internal map.- Specified by:
removein classMetricRegistry- Parameters:
metricID- ID of metric.- Returns:
- Outcome of removal.
-
removeMatching
public void removeMatching(MetricFilter filter)
- Specified by:
removeMatchingin classMetricRegistry
-
getNames
public SortedSet<String> getNames()
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns the names of all metrics in the registry.- Specified by:
getNamesin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Specified by:
getNamesin classMetricRegistry- Returns:
- a
Setcontaining the names
-
getMetricIDs
public SortedSet<MetricID> getMetricIDs()
- Specified by:
getMetricIDsin classMetricRegistry
-
getGauges
public SortedMap<MetricID,Gauge> getGauges()
- Specified by:
getGaugesin classMetricRegistry
-
getGauges
public SortedMap<MetricID,Gauge> getGauges(MetricFilter filter)
- Specified by:
getGaugesin classMetricRegistry
-
getCounters
public SortedMap<MetricID,Counter> getCounters()
- Specified by:
getCountersin classMetricRegistry
-
getCounters
public SortedMap<MetricID,Counter> getCounters(MetricFilter filter)
- Specified by:
getCountersin classMetricRegistry
-
getHistograms
public SortedMap<MetricID,Histogram> getHistograms()
- Specified by:
getHistogramsin classMetricRegistry
-
getHistograms
public SortedMap<MetricID,Histogram> getHistograms(MetricFilter filter)
- Specified by:
getHistogramsin classMetricRegistry
-
getMeters
public SortedMap<MetricID,Meter> getMeters()
- Specified by:
getMetersin classMetricRegistry
-
getMeters
public SortedMap<MetricID,Meter> getMeters(MetricFilter filter)
- Specified by:
getMetersin classMetricRegistry
-
getTimers
public SortedMap<MetricID,Timer> getTimers()
- Specified by:
getTimersin classMetricRegistry
-
getTimers
public SortedMap<MetricID,Timer> getTimers(MetricFilter filter)
- Specified by:
getTimersin classMetricRegistry
-
getConcurrentGauges
public SortedMap<MetricID,ConcurrentGauge> getConcurrentGauges()
- Specified by:
getConcurrentGaugesin classMetricRegistry
-
getConcurrentGauges
public SortedMap<MetricID,ConcurrentGauge> getConcurrentGauges(MetricFilter filter)
- Specified by:
getConcurrentGaugesin classMetricRegistry
-
getMetadata
public Map<String,Metadata> getMetadata()
- Specified by:
getMetadatain classMetricRegistry
-
getMetrics
public Map<MetricID,Metric> getMetrics()
- Specified by:
getMetricsin classMetricRegistry
-
getBridgeMetrics
public Map<io.helidon.common.metrics.InternalBridge.MetricID,Metric> getBridgeMetrics(Predicate<? super Map.Entry<? extends io.helidon.common.metrics.InternalBridge.MetricID,? extends Metric>> predicate)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics, filtered by the providedPredicate.- Specified by:
getBridgeMetricsin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
predicate- for selecting which metrics to include in the result- Returns:
- the metrics matching the criteria expressed in the predicate
-
getBridgeMetrics
public Map<io.helidon.common.metrics.InternalBridge.MetricID,Metric> getBridgeMetrics()
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics.- Specified by:
getBridgeMetricsin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Returns:
- the metrics
-
getBridgeGauges
public SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Gauge> getBridgeGauges()
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns allGaugemetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Specified by:
getBridgeGaugesin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Returns:
- a map of all gauges
-
getBridgeCounters
public SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Counter> getBridgeCounters()
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns allCountermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Specified by:
getBridgeCountersin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Returns:
- a map of all counters
-
getBridgeHistograms
public SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Histogram> getBridgeHistograms()
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns allHistogrammetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Specified by:
getBridgeHistogramsin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Returns:
- a map of all histograms
-
getBridgeMeters
public SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Meter> getBridgeMeters()
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns allMetermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Specified by:
getBridgeMetersin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Returns:
- a map of all meters
-
getBridgeTimers
public SortedMap<io.helidon.common.metrics.InternalBridge.MetricID,Timer> getBridgeTimers()
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns allTimermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Specified by:
getBridgeTimersin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Returns:
- a map of all timers
-
register
public <T extends Metric> T register(io.helidon.common.metrics.InternalBridge.Metadata metadata, T metric) throws IllegalArgumentException
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryRegisters a new metric using the specified version-neutralInternalBridge.Metadataand the typed metric itself.- Specified by:
registerin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Type Parameters:
T- the metric type- Parameters:
metadata- the metadata used in registering the metricmetric- the metric to register- Returns:
- the registered metric
- Throws:
IllegalArgumentException- if a metric with the same name but inconsistent metadata is already registered
-
register
public <T extends Metric> T register(io.helidon.common.metrics.InternalBridge.MetricID metricID, T metric) throws IllegalArgumentException
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryRegisters a new metric using the specified version-neutralInternalBridge.MetricIDand the typed metric itself.- Specified by:
registerin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Type Parameters:
T- the metric type- Parameters:
metricID- the metric ID to be used in registering the metricmetric- the metric to register- Returns:
- the registered metric
- Throws:
IllegalArgumentException- if a metric with the same identify but inconsistent metadata is already registered
-
getMetric
public Optional<Metric> getMetric(String metricName)
Access a metric by name. Used by FT library.- Parameters:
metricName- Metric name.- Returns:
- Optional metric.
-
getBridgeMetric
public Optional<Map.Entry<? extends io.helidon.common.metrics.InternalBridge.MetricID,? extends Metric>> getBridgeMetric(String metricName)
Description copied from interface:io.helidon.common.metrics.InternalBridge.MetricRegistryReturns anOptionalof theMetricIDandMetricof the metric matching the given name. If multiple metrics match on the name (this can happen in MP Metrics 2.0 if the metrics were created with different tags) then the method returns the first metric with that name, if any.- Specified by:
getBridgeMetricin interfaceio.helidon.common.metrics.InternalBridge.MetricRegistry- Parameters:
metricName- name of the metric to find- Returns:
Optionalof aMap.Entryfor the matching ID and metric
-
type
public String type()
Returns type of this registry.- Returns:
- The type.
-
empty
public boolean empty()
Determines if registry is empty.- Returns:
- Outcome of test.
-
getOptionalMetricWithIDsEntry
public Optional<Map.Entry<? extends Metric,List<MetricID>>> getOptionalMetricWithIDsEntry(String metricName)
Get internal map entry given a metric name. Synchronized for atomic access of more than one internal map.- Parameters:
metricName- The metric name.- Returns:
- Optional map entry..
-
-