Interface MetricsContext

  • All Known Implementing Classes:
    NullMetricsProvider.NullMetricsContext

    public interface MetricsContext
    A MetricsContext is like a namespace for metrics. Each component/submodule will have its own MetricsContext.

    In some cases it is possible to have a separate MetricsContext for each instance of a component, for instance on the server side a possible usecase it to gather metrics for every other peer.

    Contexts are organized in a hierarchy.

    • Method Detail

      • getContext

        MetricsContext getContext​(String name)
        Returns a sub context.
        Parameters:
        name - the name of the subcontext
        Returns:
        a new metrics context.
      • getCounter

        Counter getCounter​(String name)
        Returns a counter.
        Parameters:
        name -
        Returns:
        the counter identified by name in this context.
      • getCounterSet

        CounterSet getCounterSet​(String name)
        Returns the CounterSet identified by the given name Null name is not allowed
        Parameters:
        name -
        Returns:
        CounterSet identified by the name in this context.
      • registerGauge

        void registerGauge​(String name,
                           Gauge gauge)
        Registers an user provided Gauge which will be called by the MetricsProvider in order to sample an integer value. If another Gauge was already registered the new one will take its place. Registering a null callback is not allowed.
        Parameters:
        name - unique name of the Gauge in this context
        gauge - the implementation of the Gauge
      • unregisterGauge

        void unregisterGauge​(String name)
        Unregisters the user provided Gauge bound to the given name.
        Parameters:
        name - unique name of the Gauge in this context
      • registerGaugeSet

        void registerGaugeSet​(String name,
                              GaugeSet gaugeSet)
        Registers a user provided GaugeSet which will be called by the MetricsProvider in order to sample number values. If another GaugeSet was already registered, the new one will take its place. Registering with a null name or null callback is not allowed.
        Parameters:
        name - unique name of the GaugeSet in this context
        gaugeSet - the implementation of the GaugeSet
      • unregisterGaugeSet

        void unregisterGaugeSet​(String name)
        Unregisters the user provided GaugeSet bound to the given name. Unregistering with a null name is not allowed.
        Parameters:
        name - unique name of the GaugeSet in this context
      • getSummary

        Summary getSummary​(String name,
                           MetricsContext.DetailLevel detailLevel)
        Returns a summary.
        Parameters:
        name -
        detailLevel -
        Returns:
        the summary identified by name in this context.
      • getSummarySet

        SummarySet getSummarySet​(String name,
                                 MetricsContext.DetailLevel detailLevel)
        Returns a set of summaries.
        Parameters:
        name -
        detailLevel -
        Returns:
        the summary identified by name in this context.