Class Registry

  • All Implemented Interfaces:
    io.helidon.common.metrics.InternalBridge.MetricRegistry

    public class Registry
    extends MetricRegistry
    implements io.helidon.common.metrics.InternalBridge.MetricRegistry
    Metrics registry.
    • 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.
      • counter

        public Counter counter​(String name)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Counter using the specified name.
        Specified by:
        counter in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Specified by:
        counter in class MetricRegistry
        Parameters:
        name - name for the new Counter
        Returns:
        the Counter
      • counter

        public Counter counter​(io.helidon.common.metrics.InternalBridge.Metadata metadata)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Counter using the specified version-neutral Metadata.
        Specified by:
        counter in interface io.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.MetricRegistry
        Finds or creates a new Counter using the specified version-neutral Metadata and version-neutral Tags.
        Specified by:
        counter in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Parameters:
        metadata - used in locating and, if needed, building the counter
        tags - used in locating and, if needed, building the counter
        Returns:
        the Counter
      • histogram

        public Histogram histogram​(String name)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Histogram using the specified Metadata.
        Specified by:
        histogram in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Specified by:
        histogram in class MetricRegistry
        Parameters:
        name - used in locating and, if needed, building the histogram
        Returns:
        the Histogram
      • histogram

        public Histogram histogram​(io.helidon.common.metrics.InternalBridge.Metadata metadata)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Histogram using the specified version-neutral Metadata.
        Specified by:
        histogram in interface io.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.MetricRegistry
        Finds or creates a new Histogram using the specified version-neutral Metadata and version-neutral Tags.
        Specified by:
        histogram in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Parameters:
        metadata - used in locating and, if needed, building the histogram
        tags - used in locating and, if needed, building the histogram
        Returns:
        the Histogram
      • meter

        public Meter meter​(String name)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Meter using the specified name.
        Specified by:
        meter in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Specified by:
        meter in class MetricRegistry
        Parameters:
        name - used in locating and, if needed, building the meter
        Returns:
        the Meter
      • meter

        public Meter meter​(io.helidon.common.metrics.InternalBridge.Metadata metadata)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Meter using the specified version-neutral Metadata.
        Specified by:
        meter in interface io.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.MetricRegistry
        Finds or creates a new Meter using the specified version-neutral Metadata and version-neutral Tags.
        Specified by:
        meter in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Parameters:
        metadata - used in locating and, if needed, building the meter
        tags - used in locating and, if needed, building the meter
        Returns:
        the Meter
      • timer

        public Timer timer​(String name)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Timer using the specified name.
        Specified by:
        timer in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Specified by:
        timer in class MetricRegistry
        Parameters:
        name - used in locating and, if needed, building the timer
        Returns:
        the Timer
      • timer

        public Timer timer​(io.helidon.common.metrics.InternalBridge.Metadata metadata)
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Finds or creates a new Timer using the specified version-neutral Metadata.
        Specified by:
        timer in interface io.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.MetricRegistry
        Finds or creates a new Timer using the specified version-neutral Metadata and version-neutral Tags.
        Specified by:
        timer in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Parameters:
        metadata - used in locating and, if needed, building the timer
        tags - used in locationg and, if needed, building the timer
        Returns:
        the Timer
      • remove

        public boolean remove​(String name)
        Removes a metric by name. Synchronized for atomic update of more than one internal map.
        Specified by:
        remove in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Specified by:
        remove in class MetricRegistry
        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:
        remove in class MetricRegistry
        Parameters:
        metricID - ID of metric.
        Returns:
        Outcome of removal.
      • getNames

        public SortedSet<String> getNames()
        Description copied from interface: io.helidon.common.metrics.InternalBridge.MetricRegistry
        Returns the names of all metrics in the registry.
        Specified by:
        getNames in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Specified by:
        getNames in class MetricRegistry
        Returns:
        a Set containing the names
      • 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.MetricRegistry
        Returns all metrics from the registry as a map of version-neutral InternalBridge.MetricIDs to Metrics, filtered by the provided Predicate.
        Specified by:
        getBridgeMetrics in interface io.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.MetricRegistry
        Returns all metrics from the registry as a map of version-neutral InternalBridge.MetricIDs to Metrics.
        Specified by:
        getBridgeMetrics in interface io.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.MetricRegistry
        Returns all Gauge metrics in the registry as a map of version-neutral InternalBridge.MetricID to Metric entries.
        Specified by:
        getBridgeGauges in interface io.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.MetricRegistry
        Returns all Counter metrics in the registry as a map of version-neutral InternalBridge.MetricID to Metric entries.
        Specified by:
        getBridgeCounters in interface io.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.MetricRegistry
        Returns all Histogram metrics in the registry as a map of version-neutral InternalBridge.MetricID to Metric entries.
        Specified by:
        getBridgeHistograms in interface io.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.MetricRegistry
        Returns all Meter metrics in the registry as a map of version-neutral InternalBridge.MetricID to Metric entries.
        Specified by:
        getBridgeMeters in interface io.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.MetricRegistry
        Returns all Timer metrics in the registry as a map of version-neutral InternalBridge.MetricID to Metric entries.
        Specified by:
        getBridgeTimers in interface io.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.MetricRegistry
        Registers a new metric using the specified version-neutral InternalBridge.Metadata and the typed metric itself.
        Specified by:
        register in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Type Parameters:
        T - the metric type
        Parameters:
        metadata - the metadata used in registering the metric
        metric - 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.MetricRegistry
        Registers a new metric using the specified version-neutral InternalBridge.MetricID and the typed metric itself.
        Specified by:
        register in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Type Parameters:
        T - the metric type
        Parameters:
        metricID - the metric ID to be used in registering the metric
        metric - 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.MetricRegistry
        Returns an Optional of the MetricID and Metric of 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:
        getBridgeMetric in interface io.helidon.common.metrics.InternalBridge.MetricRegistry
        Parameters:
        metricName - name of the metric to find
        Returns:
        Optional of a Map.Entry for 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..