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 Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addCounter​(java.lang.String name)
      Add a Counter to the collector.
      void addHistogram​(java.lang.String name)
      Add a Histogram to the Collector.
      void addMeter​(java.lang.String name)
      Add a Meter to the Collector.
      void decrementCounter​(java.lang.String name)
      Decrement a Counter by one.
      void decrementCounter​(java.lang.String name, int amount)
      Decrement a Counter by the given amount.
      void incrementCounter​(java.lang.String name)
      Increment a Counter by one.
      void incrementCounter​(java.lang.String name, int amount)
      Increment a Counter by the given amount.
      void markMeter​(java.lang.String name)
      Mark a checkpoint in the Meter.
      void removeCounter​(java.lang.String name)
      Remove a Counter from the collector.
      void removeHistogram​(java.lang.String name)
      Remove a Histogram from the Collector.
      void removeMeter​(java.lang.String name)
      Remove a Meter from the Collector.
      void updateHistogram​(java.lang.String name, int amount)
      Update the Histogram with the given amount.
    • Method Detail

      • addCounter

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

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

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

        void incrementCounter​(java.lang.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​(java.lang.String name)
        Decrement a Counter by one.
        Parameters:
        name - the name of the counter.
      • decrementCounter

        void decrementCounter​(java.lang.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​(java.lang.String name)
        Add a Meter to the Collector.
        Parameters:
        name - the name of the counter.
      • removeMeter

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

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

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

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

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