Class MeterRegistryHolder

  • All Implemented Interfaces:
    MeterRegistry

    public final class MeterRegistryHolder
    extends Object
    implements MeterRegistry
    Decorator for a meter registry. It can:
    • prefix the dimensional metric names
    • prefix the hierarchical metric names
    • forward the metric creation to the decorated MeterRegistry
    • Constructor Detail

      • MeterRegistryHolder

        public MeterRegistryHolder​(String dimensionalNamePrefix,
                                   MeterRegistry registry)
        Constructor for this class.
        Parameters:
        dimensionalNamePrefix - prefix for the dimensional metric names. It will be used as a prefix for the hierarchical metric names unless a specific hierarchical name prefix is specified through hierarchicalNamePrefix(String).
        registry - the decorated registry
    • Method Detail

      • tag

        public MeterRegistryHolder tag​(String key,
                                       String value)
        Adds a tag that will be automatically added to all meters registered against this meter registry.
        Parameters:
        key - the tag's key
        value - the tag's value
        Returns:
        this meter registry
      • hierarchicalNamePrefix

        public MeterRegistryHolder hierarchicalNamePrefix​(String value)
        Add a hierarchical name prefix for this MeterRegistryHolder.
        Parameters:
        value - the value for the hierarchical name
        Returns:
        this meter registry
      • gauge

        public <T> Gauge gauge​(Meter.Id id,
                               T obj,
                               ToDoubleFunction<T> valueFunction)
        Description copied from interface: MeterRegistry
        Specified by:
        gauge in interface MeterRegistry
        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.
      • register

        public Meter register​(Meter.Id id,
                              Meter.Type type,
                              Iterable<Measurement> measurements)
        Description copied from interface: MeterRegistry
        Register a custom meter type.
        Specified by:
        register in interface MeterRegistry
        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

        public void deregisterMatching​(MeterFilter filter)
        Description copied from interface: MeterRegistry
        Deregister meters matching the provided filter.
        Specified by:
        deregisterMatching in interface MeterRegistry
        Parameters:
        filter - a non-null meter filter
      • deregisterAll

        public void deregisterAll()
        Deregister all meters held by this object.
      • more

        public MeterRegistry.More more()
        Description copied from interface: MeterRegistry
        Access to less frequently used meter types and patterns.
        Specified by:
        more in interface MeterRegistry
        Returns:
        Access to additional meter types and patterns.