Package org.apache.storm.metrics.hdrhistogram

# Class HistogramMetric

java.lang.Object
org.apache.storm.metrics.hdrhistogram.HistogramMetric

All Implemented Interfaces:
  `IMetric`

public class HistogramMetric extends Object implements IMetric
A metric wrapping an HdrHistogram.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HistogramMetric(int numberOfSignificantValueDigits)`
  `HistogramMetric(Long highestTrackableValue, int numberOfSignificantValueDigits)`
  `HistogramMetric(Long lowestDiscernibleValue, Long highestTrackableValue, int numberOfSignificantValueDigits)`
  (From the Constructor of Histogram) Construct a Histogram given the Lowest and Highest values to be tracked and a number of significant decimal digits.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `getValueAndReset()`
  Get value and reset.
  `void`
  `recordValue(long val)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.apache.storm.metric.api.IMetric

  `getDimensions`

- ## Constructor Details

  - ### HistogramMetric

    public HistogramMetric(int numberOfSignificantValueDigits)

  - ### HistogramMetric

    public HistogramMetric(Long highestTrackableValue, int numberOfSignificantValueDigits)

  - ### HistogramMetric

    public HistogramMetric(Long lowestDiscernibleValue, Long highestTrackableValue, int numberOfSignificantValueDigits)
    (From the Constructor of Histogram) Construct a Histogram given the Lowest and Highest values to be tracked and a number of significant decimal digits. Providing a lowestDiscernibleValue is useful is situations where the units used for the histogram's values are much smaller that the minimal accuracy required. E.g. when tracking time values stated in nanosecond units, where the minimal accuracy required is a microsecond, the proper value for lowestDiscernibleValue would be 1000.
    Parameters:
      `lowestDiscernibleValue` - The lowest value that can be discerned (distinguished from 0) by the histogram. Must be a positive integer that is >= 1. May be internally rounded down to nearest power of 2 (if null 1 is used).
      `highestTrackableValue` - The highest value to be tracked by the histogram. Must be a positive integer that is >= (2 * lowestDiscernibleValue). (if null 2 * lowestDiscernibleValue is used and auto-resize is enabled)
      `numberOfSignificantValueDigits` - Specifies the precision to use. This is the number of significant decimal digits to which the histogram will maintain value resolution and separation. Must be a non-negative integer between 0 and 5.

- ## Method Details

  - ### recordValue

    public void recordValue(long val)

  - ### getValueAndReset

    public Object getValueAndReset()
    Description copied from interface: `IMetric`
    Get value and reset.
    Specified by:
      `getValueAndReset` in interface `IMetric`
    Returns:
      an object that will be sent to `IMetricsConsumer.handleDataPoints(org.apache.storm.metric.api.IMetricsConsumer.TaskInfo, java.util.Collection)`. If `null` is returned nothing will be sent. If this value can be reset, like with a counter, a side effect of calling this should be that the value is reset.