Interface MetricsFactory.MetricBuilder

  • Enclosing interface:
    MetricsFactory

    public static interface MetricsFactory.MetricBuilder
    • Method Detail

      • description

        MetricsFactory.MetricBuilder description​(String description)
        Parameters:
        description - Description text of the eventual metric (optional).
        Returns:
        The builder with added description.
      • unit

        MetricsFactory.MetricBuilder unit​(String unit)
        Specify the metric unit (optional)
        Parameters:
        unit - Base unit of the eventual metric
        Returns:
        The builder with added base unit.
      • buildCounter

        void buildCounter​(Supplier<Number> countFunction)
        Register a counter that retrieves its value from a supplier function
        Parameters:
        countFunction - Function supplying a monotonically increasing number value
      • buildCounter

        <T,​R extends Number> void buildCounter​(T obj,
                                                     Function<T,​R> countFunction)
        Register a counter that retrieves its value by the applying a function to an object
        Parameters:
        obj - Object instance to observe
        countFunction - Function returning a monotonically increasing value
      • buildGauge

        void buildGauge​(Supplier<Number> gaugeFunction)
        Register a gauge that retrieves its value from a supplier function
        Parameters:
        gaugeFunction - Function supplying number value
      • buildGauge

        <T,​R extends Number> void buildGauge​(T obj,
                                                   Function<T,​R> gaugeFunction)
        Register a gauge that retrieves its value by applying a function to an object
        Parameters:
        obj - Object instance to observe
        gaugeFunction - Function returning a number value
      • buildTimer

        Runnable buildTimer​(Runnable f)
        Wrap a Runnable so that it is timed when invoked.
        Parameters:
        f - The Runnable to time when it is invoked.
        Returns:
        The wrapped Runnable.
      • buildTimer

        <T> Callable<T> buildTimer​(Callable<T> f)
        Wrap a Callable so that it is timed when invoked.
        Type Parameters:
        T - The return type of the callable.
        Parameters:
        f - The Callable to time when it is invoked.
        Returns:
        The wrapped callable.
      • buildTimer

        <T> Supplier<T> buildTimer​(Supplier<T> f)
        Wrap a Supplier so that it is timed when invoked.
        Type Parameters:
        T - The return type of the Supplier result.
        Parameters:
        f - The Supplier to time when it is invoked.
        Returns:
        The wrapped supplier.