Class MaximumLatencyHistory

  • All Implemented Interfaces:
    ChainedEventObserver, ChainedObserver, SampledStatistic<Long>, ValueStatistic<Long>

    public class MaximumLatencyHistory
    extends Object
    implements ChainedEventObserver, SampledStatistic<Long>
    Keeps a history of the maximum operation latencies over a specific window. The window needs to be as small as possible to get the most detailed history.

    This is important to note that the history is based on a sample count and not a time frame. If you set a history to 100 samples and a window of 500ms, you won't have a complete time-frame of 10 seconds. You can have a sample at t0, then another one at t0 + 1 sec depending on when the operations occur.

    Author:
    Mathieu Carbou
    • Constructor Detail

      • MaximumLatencyHistory

        public MaximumLatencyHistory​(int historySize,
                                     long windowSize,
                                     TimeUnit windowSizeUnit,
                                     LongSupplier timeSupplier)
      • MaximumLatencyHistory

        public MaximumLatencyHistory​(int historySize,
                                     long windowSize,
                                     TimeUnit windowSizeUnit,
                                     LongSupplier timeSupplier,
                                     Consumer<LatencyPeriodAccumulator> sink)
        Parameters:
        historySize - The number of samples to keep
        windowSize - The size of the window over which the reduction is applied. A small value is better for more details, but history might discard values faster.
        windowSizeUnit - Window size unit
        sink - The sink used to collect the old values that are discarded from the history.