Class ThresholdMeter

  • All Implemented Interfaces:
    Meter, Metric

    public class ThresholdMeter
    extends Object
    implements Meter
    A timestamp queue based threshold meter.

    Note: This class is thread safe, at the price of synchronization overhead. Do not use this in performance sensitive scenarios, e.g., per-record updated metrics.

    • Constructor Detail

      • ThresholdMeter

        public ThresholdMeter​(double maxEventsPerInterval,
                              Duration interval)
    • Method Detail

      • markEvent

        public void markEvent()
        Description copied from interface: Meter
        Mark occurrence of an event.
        Specified by:
        markEvent in interface Meter
      • markEvent

        public void markEvent​(long n)
        Description copied from interface: Meter
        Mark occurrence of multiple events.
        Specified by:
        markEvent in interface Meter
        Parameters:
        n - number of events occurred
      • getRate

        public double getRate()
        Description copied from interface: Meter
        Returns the current rate of events per second.
        Specified by:
        getRate in interface Meter
        Returns:
        current rate of events per second
      • getCount

        public long getCount()
        Description copied from interface: Meter
        Get number of events marked on the meter.
        Specified by:
        getCount in interface Meter
        Returns:
        number of events marked on the meter