Interface Metrics


public interface Metrics
An object that tracks service metrics.

This interface and its default implementation are based on the seda.sandstorm.internal.StageStats class written by Matt Welsh.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the name of the metric.
    double
    Returns a moving average of the service rate in milliseconds.
    double
    Returns the metric threshold.
    long
    Returns the total number of processed events.
    void
    recordServiceRate(int numEvents, long time)
    Records the service time for numEvents taking time milliseconds to be processed.
    void
    Resets all metrics.
  • Method Details

    • getName

      String getName()
      Returns the name of the metric.
    • getServiceRate

      double getServiceRate()
      Returns a moving average of the service rate in milliseconds. The default implementation divides the total time by the total number of events and then applies a smoothing factor.
    • getThreshold

      double getThreshold()
      Returns the metric threshold. The meaning of the threshold is determined by client code.

      The idea is for client code to compare getServiceRate() to the threshold and perform some action based on the comparison.

    • getTotalEvents

      long getTotalEvents()
      Returns the total number of processed events.
    • recordServiceRate

      void recordServiceRate(int numEvents, long time)
      Records the service time for numEvents taking time milliseconds to be processed.
    • reset

      void reset()
      Resets all metrics.