Interface MeterRegistry

  • All Known Implementing Classes:
    AbstractMeterRegistry, DropwizardMeterRegistry, MeterRegistryHolder, MeterRegistryHolder

    public interface MeterRegistry
    Creates and manages your application's set of meters. Exporters use the meter registry to iterate over the set of meters instrumenting your application, and then further iterate over each meter's metrics, generally resulting in a time series in the metrics backend for each combination of metrics and dimensions.

    MeterRegistry may be used in a reactive context. As such, implementations must not negatively impact the calling thread, e.g. it should respond immediately by avoiding IO call, deep stack recursion or any coordination. ForgeRock changes: - Removed all non-public methods - added previously package-private 'register' method which is used by Meter Builder - added previously package-private 'gauge|timer|counter|summary" methods used by Meter Builders - Removed @Incubating annotations - Removed 'LongTaskTimer' support - Removed 'TimeGauge' support - 'More' switched to interface, reduced to only support TimeGauge - 'Config' switched to interface

    • Method Detail

      • getMeters

        List<Meter> getMeters()
        Returns:
        The set of registered meters.
      • forEachMeter

        default void forEachMeter​(Consumer<? super Meter> consumer)
        Iterate over each meter in the registry.
        Parameters:
        consumer - Consumer of each meter during iteration.
      • config

        MeterRegistry.Config config()
        Returns:
        A configuration object used to change the behavior of this registry.
      • find

        default Search find​(String name)
        Initiate a search beginning with a metric name. If constraints added in the search are not satisfied, the search will return null.
        Parameters:
        name - The meter name to locate.
        Returns:
        A new search.
      • get

        default RequiredSearch get​(String name)
        Initiate a search beginning with a metric name. All constraints added in the search must be satisfied or a MeterNotFoundException is thrown.
        Parameters:
        name - The meter name to locate.
        Returns:
        A new search.
      • more

        MeterRegistry.More more()
        Access to less frequently used meter types and patterns.
        Returns:
        Access to additional meter types and patterns.
      • register

        Meter register​(Meter.Id id,
                       Meter.Type type,
                       Iterable<Measurement> measurements)
        Register a custom meter type.
        Parameters:
        id - Id of the meter being registered.
        type - Meter type, which may be used by naming conventions to normalize the name.
        measurements - A sequence of measurements describing how to sample the meter.
        Returns:
        The registry.
      • deregisterMatching

        void deregisterMatching​(MeterFilter filter)
        Deregister meters matching the provided filter.
        Parameters:
        filter - a non-null meter filter
      • gauge

        <T> Gauge gauge​(Meter.Id id,
                        @Nullable
                        T obj,
                        ToDoubleFunction<T> valueFunction)
        Type Parameters:
        T - The type of the state object from which the gauge value is extracted.
        Parameters:
        id - The identifier for this gauge.
        obj - State object used to compute a value.
        valueFunction - Function that is applied on the value for the number.
        Returns:
        A new or existing long task timer.
      • timer

        Timer timer​(Meter.Id id,
                    HistogramConfig histogramConfig,
                    PauseDetector pauseDetectorOverride)
        Only used by Timer.builder(String).
        Parameters:
        id - The identifier for this timer.
        histogramConfig - Configuration that governs how distribution statistics are computed.
        Returns:
        A new or existing timer.