Class HdrHistogramResetOnSnapshotReservoir

java.lang.Object
org.mpierce.metrics.reservoir.hdrhistogram.HdrHistogramResetOnSnapshotReservoir
All Implemented Interfaces:
com.codahale.metrics.Reservoir

@ThreadSafe public final class HdrHistogramResetOnSnapshotReservoir extends Object implements com.codahale.metrics.Reservoir
A Reservoir that resets its internal state every time a snapshot is taken. This is useful if you're using snapshots as a means of defining the window in which you want to calculate, say, the 99.9th percentile. Note that a snapshot will be taken for all operations that read (e.g. size()), which means the recorded state will be reset. This is because there isn't a way to read the internal state of the underlying Recorder without taking a snapshot.
  • Constructor Details

    • HdrHistogramResetOnSnapshotReservoir

      public HdrHistogramResetOnSnapshotReservoir()
      Create a reservoir with a default recorder. This recorder should be suitable for most usage.
    • HdrHistogramResetOnSnapshotReservoir

      public HdrHistogramResetOnSnapshotReservoir(org.HdrHistogram.Recorder recorder)
      Create a reservoir with a user-specified recorder.
      Parameters:
      recorder - Recorder to use
  • Method Details

    • size

      public int size()
      Specified by:
      size in interface com.codahale.metrics.Reservoir
    • update

      public void update(long value)
      Specified by:
      update in interface com.codahale.metrics.Reservoir
    • getSnapshot

      public com.codahale.metrics.Snapshot getSnapshot()
      Specified by:
      getSnapshot in interface com.codahale.metrics.Reservoir
      Returns:
      the data since the last snapshot was taken