Interface MetricCollector

All Known Implementing Classes:
AbstractMetricCollector, DefaultMetricCollector, NoopMetricCollector

public interface MetricCollector
Defines a common API for all MetricCollectors.

The MetricCollector interface is used throughout the library, independent of the actual underlying implementation. See the DefaultMetricCollector for a real implementation and the NoopMetricCollector for a discarding collector that has no runtime overhead.

Please note that the implementation is not expected to raise any kind of error if the metric does not exist. To keep the actual application code short, no extra checking needs to be done. If the counter has not been added before, the value should be discarded. An error message can be logged though.

  • Method Details

    • addCounter

      void addCounter(String name)
      Add a Counter to the collector.
      Parameters:
      name - the name of the counter.
    • removeCounter

      void removeCounter(String name)
      Remove a Counter from the collector.
      Parameters:
      name - the name of the counter.
    • incrementCounter

      void incrementCounter(String name)
      Increment a Counter by one.
      Parameters:
      name - the name of the counter.
    • incrementCounter

      void incrementCounter(String name, int amount)
      Increment a Counter by the given amount.
      Parameters:
      name - the name of the counter.
      amount - the amount to increase.
    • decrementCounter

      void decrementCounter(String name)
      Decrement a Counter by one.
      Parameters:
      name - the name of the counter.
    • decrementCounter

      void decrementCounter(String name, int amount)
      Decrement a Counter by the given amount.
      Parameters:
      name - the name of the counter.
      amount - the amount to decrease.
    • addMeter

      void addMeter(String name)
      Add a Meter to the Collector.
      Parameters:
      name - the name of the counter.
    • removeMeter

      void removeMeter(String name)
      Remove a Meter from the Collector.
      Parameters:
      name - the name of the counter.
    • markMeter

      void markMeter(String name)
      Mark a checkpoint in the Meter.
      Parameters:
      name - the name of the counter.
    • addHistogram

      void addHistogram(String name)
      Add a Histogram to the Collector.
      Parameters:
      name - the name of the counter.
    • removeHistogram

      void removeHistogram(String name)
      Remove a Histogram from the Collector.
      Parameters:
      name - the name of the counter.
    • updateHistogram

      void updateHistogram(String name, int amount)
      Update the Histogram with the given amount.
      Parameters:
      name - the name of the counter.
      amount - the amount to update.