Interface InternalBridge.MetricRegistry

  • 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

        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

        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

        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

        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

        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

        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

        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

        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

        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

        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

        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

        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
      • getBridgeMetric

        Optional<Map.Entry<? extends InternalBridge.MetricID,​? extends 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
      • register

        <T extends 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 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