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:
    SEDA
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      Returns the name of the metric.
      double getServiceRate()
      Returns a moving average of the service rate in milliseconds.
      double getThreshold()
      Returns the metric threshold.
      long getTotalEvents()
      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 reset()
      Resets all metrics.
    • Method Detail

      • getName

        java.lang.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.