Interface MetricRegistry

All Superinterfaces:
Metric, MetricSet
All Known Implementing Classes:
MetricRegistryImpl

@LimitedPrivate("Coprocesssor") @Evolving public interface MetricRegistry extends MetricSet
General purpose factory for creating various metrics.
  • Method Details

    • timer

      Get or construct a Timer used to measure durations and report rates.
      Parameters:
      name - the name of the timer.
      Returns:
      An instance of Timer.
    • histogram

      Get or construct a Histogram used to measure a distribution of values.
      Parameters:
      name - The name of the Histogram.
      Returns:
      An instance of Histogram.
    • meter

      Get or construct a Meter used to measure durations and report distributions (a combination of a Timer and a Histogram.
      Parameters:
      name - The name of the Meter.
      Returns:
      An instance of Meter.
    • counter

      Get or construct a Counter used to track a mutable number.
      Parameters:
      name - The name of the Counter
      Returns:
      An instance of Counter.
    • register

      <T> Gauge<T> register(String name, Gauge<T> gauge)
      Register a Gauge. The Gauge will be invoked at a period defined by the implementation of MetricRegistry.
      Parameters:
      name - The name of the Gauge.
      gauge - A callback to compute the current value.
      Returns:
      the registered gauge, or the existing gauge
    • register

      Metric register(String name, Metric metric)
      Registers the Metric with the given name if there does not exist one with the same name. Returns the newly registered or existing Metric.
      Parameters:
      name - The name of the Metric.
      metric - the metric to register
      Returns:
      the registered metric, or the existing metrid
    • registerAll

      void registerAll(MetricSet metricSet)
      Registers the Metrics in the given MetricSet.
      Parameters:
      metricSet - set of metrics to register.
    • get

      Returns previously registered metric with the name if any.
      Parameters:
      name - the name of the metric
      Returns:
      previously registered metric
    • remove

      boolean remove(String name)
      Removes the metric with the given name.
      Parameters:
      name - the name of the metric
      Returns:
      true if the metric is removed.
    • remove

      boolean remove(String name, Metric metric)
      Removes the metric with the given name only if it is registered to the provided metric.
      Parameters:
      name - the name of the metric
      metric - the metric expected to be registered to the given name
      Returns:
      true if the metric is removed.
    • getMetricRegistryInfo

      Return the MetricRegistryInfo object for this registry.
      Returns:
      MetricRegistryInfo describing the registry.