Package io.helidon.common.metrics
Interface InternalBridge.MetricRegistry
-
- Enclosing interface:
- InternalBridge
public static interface InternalBridge.MetricRegistryAbstraction of theMetricRegistrybehavior used by internal Helidon clients.The exposed methods use version-neutral abstractions for
Metadata,MetricID, andTagwhich are used by MicroProfile Metrics. Some methods havebridgein their names because the corresponding MicroProfile Metrics methods changed return type but kept the same signature from 1.1 to 2.0, so here they need distinct names to distinguish them from the spec-prescribed methods (that do not use the version-neutral constructs).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceInternalBridge.MetricRegistry.RegistryFactoryAbstraction of theRegistryFactorybehavior used by internal Helidon clients.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Countercounter(InternalBridge.Metadata metadata)Finds or creates a newCounterusing the specified version-neutralMetadata.Countercounter(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.SortedMap<InternalBridge.MetricID,Counter>getBridgeCounters()Returns allCountermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedMap<InternalBridge.MetricID,Gauge>getBridgeGauges()Returns allGaugemetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedMap<InternalBridge.MetricID,Histogram>getBridgeHistograms()Returns allHistogrammetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedMap<InternalBridge.MetricID,Meter>getBridgeMeters()Returns allMetermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.Optional<Map.Entry<? extends InternalBridge.MetricID,? extends Metric>>getBridgeMetric(String metricName)Map<InternalBridge.MetricID,Metric>getBridgeMetrics()Returns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics.Map<InternalBridge.MetricID,Metric>getBridgeMetrics(Predicate<? super Map.Entry<? extends InternalBridge.MetricID,? extends Metric>> predicate)Returns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics, filtered by the providedPredicate.SortedMap<InternalBridge.MetricID,Timer>getBridgeTimers()Returns allTimermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.SortedSet<String>getNames()Returns the names of all metrics in the registry.Histogramhistogram(InternalBridge.Metadata metadata)Finds or creates a newHistogramusing the specified version-neutralMetadata.Histogramhistogram(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.Metermeter(InternalBridge.Metadata metadata)Finds or creates a newMeterusing the specified version-neutralMetadata.Metermeter(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.<T extends Metric>
Tregister(InternalBridge.Metadata metadata, T metric)Registers a new metric using the specified version-neutralInternalBridge.Metadataand the typed metric itself.<T extends Metric>
Tregister(InternalBridge.MetricID metricID, T metric)Registers a new metric using the specified version-neutralInternalBridge.MetricIDand the typed metric itself.booleanremove(String name)Removes the metrics with matching name from the registry.Timertimer(InternalBridge.Metadata metadata)Finds or creates a newTimerusing the specified version-neutralMetadata.Timertimer(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.
-
-
-
Method Detail
-
counter
Counter counter(InternalBridge.Metadata metadata)
Finds or creates a newCounterusing the specified version-neutralMetadata.- Parameters:
metadata- used in locating and, if needed, building the counter- Returns:
- the
Counter
-
counter
Counter counter(InternalBridge.Metadata metadata, Map<String,String> tags)
Finds or creates a new Counter using the specified version-neutralMetadataand version-neutralTags.- Parameters:
metadata- used in locating and, if needed, building the countertags- used in locating and, if needed, building the counter- Returns:
- the
Counter
-
counter
Counter counter(String name)
Finds or creates a newCounterusing the specified name.- Parameters:
name- name for the newCounter- Returns:
- the
Counter
-
meter
Meter meter(InternalBridge.Metadata metadata)
Finds or creates a newMeterusing the specified version-neutralMetadata.- Parameters:
metadata- used in locating and, if needed, building the meter- Returns:
- the
Meter
-
meter
Meter meter(InternalBridge.Metadata metadata, Map<String,String> tags)
Finds or creates a newMeterusing the specified version-neutralMetadataand version-neutralTags.- Parameters:
metadata- used in locating and, if needed, building the metertags- used in locating and, if needed, building the meter- Returns:
- the
Meter
-
meter
Meter meter(String name)
Finds or creates a newMeterusing the specified name.- Parameters:
name- used in locating and, if needed, building the meter- Returns:
- the
Meter
-
histogram
Histogram histogram(InternalBridge.Metadata metadata)
Finds or creates a newHistogramusing the specified version-neutralMetadata.- Parameters:
metadata- used in locating and, if needed, building the histogram- Returns:
- the
Histogram
-
histogram
Histogram histogram(InternalBridge.Metadata metadata, Map<String,String> tags)
Finds or creates a newHistogramusing the specified version-neutralMetadataand version-neutralTags.- Parameters:
metadata- used in locating and, if needed, building the histogramtags- used in locating and, if needed, building the histogram- Returns:
- the
Histogram
-
histogram
Histogram histogram(String name)
Finds or creates a newHistogramusing the specifiedMetadata.- Parameters:
name- used in locating and, if needed, building the histogram- Returns:
- the
Histogram
-
timer
Timer timer(InternalBridge.Metadata metadata)
Finds or creates a newTimerusing the specified version-neutralMetadata.- Parameters:
metadata- used in locating and, if needed, building the timer- Returns:
- the
Timer
-
timer
Timer timer(InternalBridge.Metadata metadata, Map<String,String> tags)
Finds or creates a newTimerusing the specified version-neutralMetadataand version-neutralTags.- Parameters:
metadata- used in locating and, if needed, building the timertags- used in locationg and, if needed, building the timer- Returns:
- the
Timer
-
timer
Timer timer(String name)
Finds or creates a newTimerusing the specified name.- Parameters:
name- used in locating and, if needed, building the timer- Returns:
- the
Timer
-
getBridgeMetrics
Map<InternalBridge.MetricID,Metric> getBridgeMetrics()
Returns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics.- Returns:
- the metrics
-
getBridgeMetrics
Map<InternalBridge.MetricID,Metric> getBridgeMetrics(Predicate<? super Map.Entry<? extends InternalBridge.MetricID,? extends Metric>> predicate)
Returns all metrics from the registry as a map of version-neutralInternalBridge.MetricIDs toMetrics, filtered by the providedPredicate.- Parameters:
predicate- for selecting which metrics to include in the result- Returns:
- the metrics matching the criteria expressed in the predicate
-
getBridgeMetric
Optional<Map.Entry<? extends InternalBridge.MetricID,? extends Metric>> getBridgeMetric(String metricName)
Returns 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.- Parameters:
metricName- name of the metric to find- Returns:
Optionalof aMap.Entryfor the matching ID and metric
-
getNames
SortedSet<String> getNames()
Returns the names of all metrics in the registry.- Returns:
- a
Setcontaining the names
-
getBridgeCounters
SortedMap<InternalBridge.MetricID,Counter> getBridgeCounters()
Returns allCountermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Returns:
- a map of all counters
-
getBridgeGauges
SortedMap<InternalBridge.MetricID,Gauge> getBridgeGauges()
Returns allGaugemetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Returns:
- a map of all gauges
-
getBridgeHistograms
SortedMap<InternalBridge.MetricID,Histogram> getBridgeHistograms()
Returns allHistogrammetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Returns:
- a map of all histograms
-
getBridgeMeters
SortedMap<InternalBridge.MetricID,Meter> getBridgeMeters()
Returns allMetermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Returns:
- a map of all meters
-
getBridgeTimers
SortedMap<InternalBridge.MetricID,Timer> getBridgeTimers()
Returns allTimermetrics in the registry as a map of version-neutralInternalBridge.MetricIDtoMetricentries.- Returns:
- a map of all timers
-
register
<T extends Metric> T register(InternalBridge.Metadata metadata, T metric) throws IllegalArgumentException
Registers a new metric using the specified version-neutralInternalBridge.Metadataand the typed metric itself.- 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
<T extends Metric> T register(InternalBridge.MetricID metricID, T metric) throws IllegalArgumentException
Registers a new metric using the specified version-neutralInternalBridge.MetricIDand the typed metric itself.- 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
-
remove
boolean remove(String name)
Removes the metrics with matching name from the registry.- Parameters:
name- name of the metric- Returns:
- true if a matching metric was removed; false otherwise
-
-