public abstract class ProducerTimingRecorder
extends java.lang.Object
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.
Constructor and Description |
---|
ProducerTimingRecorder() |
Modifier and Type | Method and 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.
|
public void recordMethod(long startedNanos, long durationNanos)
If the producer was skipped due to any of its inputs failing, then this will not be called.
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.public void recordSuccess(long latencyNanos)
If the producer was skipped due to any of its inputs failing, then this will not be called.
latencyNanos
- the wall-clock time, in nanoseconds, of the producer's latency, measured
from when the producer method started to when the future finished.public void recordFailure(java.lang.Throwable exception, long latencyNanos)
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.public void recordSkip(java.lang.Throwable exception)
exception
- the exception that its input failed with. If multiple inputs failed, this
exception will be chosen arbitrarily from the input failures.public static ProducerTimingRecorder noOp()