Class HdrHistogram

java.lang.Object
io.confluent.kafka.replication.push.metrics.HdrHistogram

public final class HdrHistogram extends Object

A wrapper on top of the HdrHistogram API. It handles writing to the histogram by delegating to an internal ValueRecorder implementation, and reading from the histogram by efficiently implementing the retrieval of up-to-date histogram data (the exact implementation of these varies depending on the HdrHistogram.ThreadSafetyMode with which the provider is initialized).

Note that all APIs expect a timestamp which is used by the histogram to discard decaying data and determine when the snapshot from which the histogram metrics are calculated should be refreshed.

  • Constructor Details

  • Method Details

    • record

      public void record(long value)
      Writes to the histogram. Will throw ArrayIndexOutOfBoundsException if the histogram's highestTrackableValue is lower than the value being recorded.
      Parameters:
      value - The value to be recorded. Cannot be negative.
    • count

      public long count(long now)
      Parameters:
      now - An externally provided timestamp expected to be in milliseconds.
      Returns:
      The total number of updates recorded by the histogram, i.e. the number of times record(long) has been called.
    • max

      public long max(long now)
      Parameters:
      now - An externally provided timestamp expected to be in milliseconds.
      Returns:
      The maximum value recorded by the histogram.
    • mean

      public double mean(long now)
      Parameters:
      now - An externally provided timestamp expected to be in milliseconds.
      Returns:
      The mean/average of all the values recorded by the histogram.
    • min

      public long min(long now)
      Parameters:
      now - An externally provided timestamp expected to be in milliseconds.
      Returns:
      The minimum value recorded by the histogram.
    • stdDeviation

      public double stdDeviation(long now)
      Parameters:
      now - An externally provided timestamp expected to be in milliseconds.
      Returns:
      The population standard deviation of all the values recorded by the histogram.
    • measurePercentile

      public double measurePercentile(long now, double percentile)
      Reads percentile data from the histogram.
      Parameters:
      now - An externally provided timestamp expected to be in milliseconds.
      percentile - The percentile for which a value is going to be retrieved. Expected to be between 0.0 and 100.0.
      Returns:
      The histogram value for the given percentile.