Interface InternalBridge.MetricRegistry

  • All Known Implementing Classes:
    Registry
    Enclosing interface:
    InternalBridge

    public static interface InternalBridge.MetricRegistry
    Abstraction of the MetricRegistry behavior used by internal Helidon clients.

    The exposed methods use version-neutral abstractions for Metadata, MetricID, and Tag which are used by MicroProfile Metrics. Some methods have bridge in 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).

    • Method Detail

      • counter

        org.eclipse.microprofile.metrics.Counter counter​(InternalBridge.Metadata metadata)
        Finds or creates a new Counter using the specified version-neutral Metadata.
        Parameters:
        metadata - used in locating and, if needed, building the counter
        Returns:
        the Counter
      • counter

        org.eclipse.microprofile.metrics.Counter counter​(InternalBridge.Metadata metadata,
                                                         Map<String,​String> tags)
        Finds or creates a new Counter using the specified version-neutral Metadata and version-neutral Tags.
        Parameters:
        metadata - used in locating and, if needed, building the counter
        tags - used in locating and, if needed, building the counter
        Returns:
        the Counter
      • counter

        org.eclipse.microprofile.metrics.Counter counter​(String name)
        Finds or creates a new Counter using the specified name.
        Parameters:
        name - name for the new Counter
        Returns:
        the Counter
      • meter

        org.eclipse.microprofile.metrics.Meter meter​(InternalBridge.Metadata metadata)
        Finds or creates a new Meter using the specified version-neutral Metadata.
        Parameters:
        metadata - used in locating and, if needed, building the meter
        Returns:
        the Meter
      • meter

        org.eclipse.microprofile.metrics.Meter meter​(InternalBridge.Metadata metadata,
                                                     Map<String,​String> tags)
        Finds or creates a new Meter using the specified version-neutral Metadata and version-neutral Tags.
        Parameters:
        metadata - used in locating and, if needed, building the meter
        tags - used in locating and, if needed, building the meter
        Returns:
        the Meter
      • meter

        org.eclipse.microprofile.metrics.Meter meter​(String name)
        Finds or creates a new Meter using the specified name.
        Parameters:
        name - used in locating and, if needed, building the meter
        Returns:
        the Meter
      • histogram

        org.eclipse.microprofile.metrics.Histogram histogram​(InternalBridge.Metadata metadata)
        Finds or creates a new Histogram using the specified version-neutral Metadata.
        Parameters:
        metadata - used in locating and, if needed, building the histogram
        Returns:
        the Histogram
      • histogram

        org.eclipse.microprofile.metrics.Histogram histogram​(InternalBridge.Metadata metadata,
                                                             Map<String,​String> tags)
        Finds or creates a new Histogram using the specified version-neutral Metadata and version-neutral Tags.
        Parameters:
        metadata - used in locating and, if needed, building the histogram
        tags - used in locating and, if needed, building the histogram
        Returns:
        the Histogram
      • histogram

        org.eclipse.microprofile.metrics.Histogram histogram​(String name)
        Finds or creates a new Histogram using the specified Metadata.
        Parameters:
        name - used in locating and, if needed, building the histogram
        Returns:
        the Histogram
      • timer

        org.eclipse.microprofile.metrics.Timer timer​(InternalBridge.Metadata metadata)
        Finds or creates a new Timer using the specified version-neutral Metadata.
        Parameters:
        metadata - used in locating and, if needed, building the timer
        Returns:
        the Timer
      • timer

        org.eclipse.microprofile.metrics.Timer timer​(InternalBridge.Metadata metadata,
                                                     Map<String,​String> tags)
        Finds or creates a new Timer using the specified version-neutral Metadata and version-neutral Tags.
        Parameters:
        metadata - used in locating and, if needed, building the timer
        tags - used in locationg and, if needed, building the timer
        Returns:
        the Timer
      • timer

        org.eclipse.microprofile.metrics.Timer timer​(String name)
        Finds or creates a new Timer using the specified name.
        Parameters:
        name - used in locating and, if needed, building the timer
        Returns:
        the Timer
      • getBridgeMetrics

        Map<InternalBridge.MetricID,​org.eclipse.microprofile.metrics.Metric> getBridgeMetrics​(Predicate<? super Map.Entry<? extends InternalBridge.MetricID,​? extends org.eclipse.microprofile.metrics.Metric>> predicate)
        Returns all metrics from the registry as a map of version-neutral InternalBridge.MetricIDs to Metrics, filtered by the provided Predicate.
        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 org.eclipse.microprofile.metrics.Metric>> getBridgeMetric​(String metricName)
        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.
        Parameters:
        metricName - name of the metric to find
        Returns:
        Optional of a Map.Entry for the matching ID and metric
      • getNames

        SortedSet<String> getNames()
        Returns the names of all metrics in the registry.
        Returns:
        a Set containing the names
      • getBridgeHistograms

        SortedMap<InternalBridge.MetricID,​org.eclipse.microprofile.metrics.Histogram> getBridgeHistograms()
        Returns all Histogram metrics in the registry as a map of version-neutral InternalBridge.MetricID to Metric entries.
        Returns:
        a map of all histograms
      • register

        <T extends org.eclipse.microprofile.metrics.Metric> T register​(InternalBridge.Metadata metadata,
                                                                       T metric)
                                                                throws IllegalArgumentException
        Registers a new metric using the specified version-neutral InternalBridge.Metadata and the typed metric itself.
        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

        <T extends org.eclipse.microprofile.metrics.Metric> T register​(InternalBridge.MetricID metricID,
                                                                       T metric)
                                                                throws IllegalArgumentException
        Registers a new metric using the specified version-neutral InternalBridge.MetricID and the typed metric itself.
        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
      • 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