java.lang.Object
io.helidon.metrics.api.AbstractRegistry<io.helidon.metrics.HelidonMetric>
io.helidon.metrics.Registry
- All Implemented Interfaces:
MetricRegistry
Metrics registry.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.helidon.metrics.api.AbstractRegistry
AbstractRegistry.GaugeFactoryNested classes/interfaces inherited from interface org.eclipse.microprofile.metrics.MetricRegistry
MetricRegistry.Type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRegistry(MetricRegistry.Type type, RegistrySettings registrySettings) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic Registrycreate(MetricRegistry.Type type, RegistrySettings registrySettings) Create a registry of a certain type.createGauge(Metadata metadata, Supplier<R> supplier) Creates a gauge instance according to the specified supplier which returns the gauge value.createGauge(Metadata metadata, T object, Function<T, R> func) Creates a gauge instance according to the provided metadata such that retrievals of the gauge value trigger an invocation of the provided function, passing the indicated object.getMetricsByName(String metricName) Returns a list of metric ID/metric pairs which match the provided metric name.getOptionalMetricEntry(String metricName) Returns anOptionalfor an entry containing a metric ID and the corresponding metric matching the specified metric name.protected booleanisMetricEnabled(String metricName) Indicates whether the specified metric name is enabled or not.protected Map<MetricType,BiFunction<String, Metadata, io.helidon.metrics.HelidonMetric>> For testing.metricIDsForName(String metricName) Returns a list of metric IDs given a metric name.protected Map<MetricType,BiFunction<String, Metadata, io.helidon.metrics.HelidonMetric>> Provides a map from MicroProfile metric type to a factory which creates a concrete metric instance of the MP metric type which also extends the implementation metric base class for the concrete implementation (e.g., no-op or full-featured).protected Map<Class<? extends io.helidon.metrics.HelidonMetric>,MetricType> Prepares the map from Java types of implementation metrics to the correspondingMetricType.stream()Returns a stream ofMap.Entryfor this registry for enabled metrics.protected <T extends Metric>
io.helidon.metrics.HelidonMetricCreates a new instance of an implementation wrapper around the indicated metric.voidupdate(RegistrySettings registrySettings) Update the registry settings for this registry.Methods inherited from class io.helidon.metrics.api.AbstractRegistry
concurrentGauge, concurrentGauge, concurrentGauge, concurrentGauge, concurrentGauge, counter, counter, counter, counter, counter, deriveType, empty, gauge, gauge, gauge, gauge, gauge, gauge, getConcurrentGauge, getConcurrentGauges, getConcurrentGauges, getCounter, getCounters, getCounters, getGauge, getGauges, getGauges, getHistogram, getHistograms, getHistograms, getMetadata, getMetadata, getMeter, getMeters, getMeters, getMetric, getMetric, getMetricIDs, getMetrics, getMetrics, getMetrics, getNames, getSimpleTimer, getSimpleTimers, getSimpleTimers, getTimer, getTimers, getTimers, getType, histogram, histogram, histogram, histogram, histogram, isMarkedAsDeleted, isStrictExemplars, metadataWithIDs, meter, meter, meter, meter, meter, register, register, register, registrySettings, remove, remove, removeMatching, simpleTimer, simpleTimer, simpleTimer, simpleTimer, simpleTimer, timer, timer, timer, timer, timer, toString, type
-
Constructor Details
-
Registry
Creates a new instance.- Parameters:
type- registry type for the new registryregistrySettings- registry settings to influence the created registry
-
-
Method Details
-
create
Create a registry of a certain type.- Parameters:
type- Registry type.registrySettings- Registry settings to use in creating the registry.- Returns:
- The newly created registry.
-
update
Description copied from class:AbstractRegistryUpdate the registry settings for this registry.- Overrides:
updatein classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Parameters:
registrySettings- new settings to use going forward
-
isMetricEnabled
Description copied from class:AbstractRegistryIndicates whether the specified metric name is enabled or not.Concrete implementations of this method should account for registry settings that might have disabled the specified metric or the registry as a whole. They do not need to check whether metrics in its entirety is enabled.
- Specified by:
isMetricEnabledin classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Parameters:
metricName- name of the metric to check- Returns:
- true if the metric is enabled; false otherwise
-
toImpl
Description copied from class:AbstractRegistryCreates a new instance of an implementation wrapper around the indicated metric.- Specified by:
toImplin classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Type Parameters:
T- specific type ofMetricprovided and wrapped- Parameters:
metadata-Metadatafor the metricmetric- the existing metric to be wrapped by the impl- Returns:
- new wrapper implementation around the specified metric instance
-
prepareMetricToTypeMap
protected Map<Class<? extends io.helidon.metrics.HelidonMetric>,MetricType> prepareMetricToTypeMap()Description copied from class:AbstractRegistryPrepares the map from Java types of implementation metrics to the correspondingMetricType.- Specified by:
prepareMetricToTypeMapin classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Returns:
- prepared map for a given metrics implementation
-
createGauge
Description copied from class:AbstractRegistryCreates a gauge instance according to the specified supplier which returns the gauge value.- Specified by:
createGaugein classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Type Parameters:
R- specificNumbersubtype the supplier returns- Parameters:
metadata- metadata to use in creating the gaugesupplier- gauge-value-returning supplier- Returns:
- new gauge
-
prepareMetricFactories
protected Map<MetricType,BiFunction<String, prepareMetricFactories()Metadata, io.helidon.metrics.HelidonMetric>> Description copied from class:AbstractRegistryProvides a map from MicroProfile metric type to a factory which creates a concrete metric instance of the MP metric type which also extends the implementation metric base class for the concrete implementation (e.g., no-op or full-featured).- Specified by:
prepareMetricFactoriesin classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Returns:
- map from each MicroProfile metric type to the correspondingfactory method
-
createGauge
protected <T,R extends Number> Gauge<R> createGauge(Metadata metadata, T object, Function<T, R> func) Description copied from class:AbstractRegistryCreates a gauge instance according to the provided metadata such that retrievals of the gauge value trigger an invocation of the provided function, passing the indicated object.This default implementation uses a capturing lambda for retrieving the value. Concrete subclasses can override this implementation if capturing lambda behavior might become a performance issue.
- Overrides:
createGaugein classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Type Parameters:
T- Java type of the function parameter (and the object to pass to it)R- specificNumbersubtype the gauge reports- Parameters:
metadata- metadata to use in creating the gaugeobject- object to pass to the value-returning functionfunc- gauge-value-returning function- Returns:
- new gauge
-
getOptionalMetricEntry
protected Optional<Map.Entry<MetricID,io.helidon.metrics.HelidonMetric>> getOptionalMetricEntry(String metricName) Description copied from class:AbstractRegistryReturns anOptionalfor an entry containing a metric ID and the corresponding metric matching the specified metric name.If multiple metrics match the name (because of tags), the returned metric is, preferentially, the one (if any) with no tags. If all metrics registered under the specified name have tags, then the method returns the metric which was registered earliest
- Overrides:
getOptionalMetricEntryin classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Parameters:
metricName- name of the metric of interest- Returns:
Optionalof a map entry containing the metric ID and the metric selected
-
metricFactories
protected Map<MetricType,BiFunction<String, metricFactories()Metadata, io.helidon.metrics.HelidonMetric>> Description copied from class:AbstractRegistryFor testing.- Overrides:
metricFactoriesin classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Returns:
- map from MicroProfile metric type to factory functions.
-
stream
Description copied from class:AbstractRegistryReturns a stream ofMap.Entryfor this registry for enabled metrics.- Overrides:
streamin classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Returns:
- Stream of
Map.Entry
-
metricIDsForName
Description copied from class:AbstractRegistryReturns a list of metric IDs given a metric name.- Overrides:
metricIDsForNamein classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Parameters:
metricName- name of the metric of interest- Returns:
- list of metric IDs for metrics with the specified name; empty if no matches
-
getMetricsByName
protected List<Map.Entry<MetricID,io.helidon.metrics.HelidonMetric>> getMetricsByName(String metricName) Description copied from class:AbstractRegistryReturns a list of metric ID/metric pairs which match the provided metric name.- Overrides:
getMetricsByNamein classAbstractRegistry<io.helidon.metrics.HelidonMetric>- Parameters:
metricName- name of the metric of interest- Returns:
- List of entries indicating metrics with the specified name; empty of no matches
-