Class ProducerTimingRecorder


  • public abstract class ProducerTimingRecorder
    extends java.lang.Object
    A hook for recording the timing of the execution of individual producer methods. See ProductionComponentTimingRecorder for how to install these monitors.

    If any of the recorder's methods throw, then the exception will be logged and processing will continue unaffected.

    All timings are measured at nanosecond precision, but not necessarily nanosecond resolution. That is, timings will be reported in nanoseconds, but the timing source will not necessarily update at nanosecond resolution. For example, System.nanoTime() would satisfy these constraints.

    Since:
    2.1
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ProducerTimingRecorder noOp()
      Returns a producer recorder that does nothing.
      void recordFailure​(java.lang.Throwable exception, long latencyNanos)
      Reports that the producer's future has failed with the given statistics.
      void recordMethod​(long startedNanos, long durationNanos)
      Reports that the producer method has finished executing with the given statistics.
      void recordSkip​(java.lang.Throwable exception)
      Reports that the producer was skipped because one of its inputs failed.
      void recordSuccess​(long latencyNanos)
      Reports that the producer's future has succeeded with the given statistics.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProducerTimingRecorder

        public ProducerTimingRecorder()
    • Method Detail

      • recordMethod

        public void recordMethod​(long startedNanos,
                                 long durationNanos)
        Reports that the producer method has finished executing with the given statistics.

        If the producer was skipped due to any of its inputs failing, then this will not be called.

        Parameters:
        startedNanos - the wall-clock time, in nanoseconds, when the producer method started executing, measured from when the first method on the production component was called.
        durationNanos - the wall-clock time, in nanoseconds, that the producer method took to execute.
      • recordSuccess

        public void recordSuccess​(long latencyNanos)
        Reports that the producer's future has succeeded with the given statistics.

        If the producer was skipped due to any of its inputs failing, then this will not be called.

        Parameters:
        latencyNanos - the wall-clock time, in nanoseconds, of the producer's latency, measured from when the producer method started to when the future finished.
      • recordFailure

        public void recordFailure​(java.lang.Throwable exception,
                                  long latencyNanos)
        Reports that the producer's future has failed with the given statistics.
        Parameters:
        exception - the exception that the future failed with.
        latencyNanos - the wall-clock time, in nanoseconds, of the producer's latency, measured from when the producer method started to when the future finished.
      • recordSkip

        public void recordSkip​(java.lang.Throwable exception)
        Reports that the producer was skipped because one of its inputs failed.
        Parameters:
        exception - the exception that its input failed with. If multiple inputs failed, this exception will be chosen arbitrarily from the input failures.