java.lang.Object
io.helidon.metrics.api.AbstractRegistry
io.helidon.metrics.Registry
- All Implemented Interfaces:
Registry,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.booleanWhether a metric is enabled.protected Map<MetricType,BiFunction<String, Metadata, HelidonMetric>> For testing.metricIDsForName(String metricName) Returns a list of metric IDs given a metric name.protected Map<MetricType,BiFunction<String, Metadata, 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 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 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, find, 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, list, meter, meter, meter, meter, meter, metricIdsByName, metricsByName, register, register, register, 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- Parameters:
registrySettings- new settings to use going forward
-
enabled
Description copied from interface:RegistryWhether a metric is enabled. Metrics can be disabled by name (disables all IDs associated with that name).- Parameters:
metricName- name to look for- Returns:
- whether the metric is enabled
-
toImpl
Description copied from class:AbstractRegistryCreates a new instance of an implementation wrapper around the indicated metric.- Specified by:
toImplin classAbstractRegistry- Parameters:
metadata-Metadatafor the metricmetric- the existing metric to be wrapped by the impl- Returns:
- new wrapper implementation around the specified metric instance
-
prepareMetricToTypeMap
Description copied from class:AbstractRegistryPrepares the map from Java types of implementation metrics to the correspondingMetricType.- Specified by:
prepareMetricToTypeMapin classAbstractRegistry- 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- Type Parameters:
R- specificNumbersubtype the supplier returns- Parameters:
metadata- metadata to use in creating the gaugesupplier- gauge-value-returning supplier- Returns:
- new gauge
-
prepareMetricFactories
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- 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- 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
-
metricFactories
Description copied from class:AbstractRegistryFor testing.- Overrides:
metricFactoriesin classAbstractRegistry- Returns:
- map from MicroProfile metric type to factory functions.
-
stream
Description copied from class:AbstractRegistryReturns a stream ofMap.Entryfor this registry for enabled metrics.- Specified by:
streamin interfaceRegistry- Overrides:
streamin classAbstractRegistry- Returns:
- Stream of
Map.Entry
-
metricIDsForName
Description copied from class:AbstractRegistryReturns a list of metric IDs given a metric name.- Overrides:
metricIDsForNamein classAbstractRegistry- Parameters:
metricName- name of the metric of interest- Returns:
- list of metric IDs for metrics with the specified name; empty if no matches
-