Class Registry

All Implemented Interfaces:
Registry, MetricRegistry

public class Registry extends AbstractRegistry
Metrics registry.
  • Constructor Details

    • Registry

      protected Registry(MetricRegistry.Type type, RegistrySettings registrySettings)
      Creates a new instance.
      Parameters:
      type - registry type for the new registry
      registrySettings - registry settings to influence the created registry
  • Method Details

    • create

      public static Registry create(MetricRegistry.Type type, RegistrySettings registrySettings)
      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

      public void update(RegistrySettings registrySettings)
      Description copied from class: AbstractRegistry
      Update the registry settings for this registry.
      Overrides:
      update in class AbstractRegistry
      Parameters:
      registrySettings - new settings to use going forward
    • enabled

      public boolean enabled(String metricName)
      Description copied from interface: Registry
      Whether 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

      protected io.helidon.metrics.HelidonMetric toImpl(Metadata metadata, Metric metric)
      Description copied from class: AbstractRegistry
      Creates a new instance of an implementation wrapper around the indicated metric.
      Specified by:
      toImpl in class AbstractRegistry
      Parameters:
      metadata - Metadata for the metric
      metric - the existing metric to be wrapped by the impl
      Returns:
      new wrapper implementation around the specified metric instance
    • prepareMetricToTypeMap

      protected Map<Class<? extends HelidonMetric>,MetricType> prepareMetricToTypeMap()
      Description copied from class: AbstractRegistry
      Prepares the map from Java types of implementation metrics to the corresponding MetricType.
      Specified by:
      prepareMetricToTypeMap in class AbstractRegistry
      Returns:
      prepared map for a given metrics implementation
    • createGauge

      protected <R extends Number> Gauge<R> createGauge(Metadata metadata, Supplier<R> supplier)
      Description copied from class: AbstractRegistry
      Creates a gauge instance according to the specified supplier which returns the gauge value.
      Specified by:
      createGauge in class AbstractRegistry
      Type Parameters:
      R - specific Number subtype the supplier returns
      Parameters:
      metadata - metadata to use in creating the gauge
      supplier - gauge-value-returning supplier
      Returns:
      new gauge
    • prepareMetricFactories

      protected Map<MetricType,BiFunction<String,Metadata,HelidonMetric>> prepareMetricFactories()
      Description copied from class: AbstractRegistry
      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).
      Specified by:
      prepareMetricFactories in class AbstractRegistry
      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: AbstractRegistry
      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.

      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:
      createGauge in class AbstractRegistry
      Type Parameters:
      T - Java type of the function parameter (and the object to pass to it)
      R - specific Number subtype the gauge reports
      Parameters:
      metadata - metadata to use in creating the gauge
      object - object to pass to the value-returning function
      func - gauge-value-returning function
      Returns:
      new gauge
    • metricFactories

      protected Map<MetricType,BiFunction<String,Metadata,HelidonMetric>> metricFactories()
      Description copied from class: AbstractRegistry
      For testing.
      Overrides:
      metricFactories in class AbstractRegistry
      Returns:
      map from MicroProfile metric type to factory functions.
    • stream

      public Stream<MetricInstance> stream()
      Description copied from class: AbstractRegistry
      Returns a stream of Map.Entry for this registry for enabled metrics.
      Specified by:
      stream in interface Registry
      Overrides:
      stream in class AbstractRegistry
      Returns:
      Stream of Map.Entry
    • metricIDsForName

      protected List<MetricID> metricIDsForName(String metricName)
      Description copied from class: AbstractRegistry
      Returns a list of metric IDs given a metric name.
      Overrides:
      metricIDsForName in class AbstractRegistry
      Parameters:
      metricName - name of the metric of interest
      Returns:
      list of metric IDs for metrics with the specified name; empty if no matches