A histogram.

Stores the counts per bucket and tracks the count of added samples and the total sum. The bucketing algorithm can be changed.

Constructors

Properties

bucketing: Bucketing
count: number
sum: number
values: Record<number, number>

Methods

  • Adds a single value to the histogram.

    Parameters

    • sample: number

      The value to add to the histogram.

    Returns void

  • Gets the number of buckets in the Histogram.

    Returns number

    The number of buckets in the histogram.

  • Checks if this histogram recorded any values.

    Returns boolean

    Whether the histogram has any values.

  • Gets a snapshot of all values from the first bucket until one past the last filled bucket, filling in empty buckets with 0.

    If a snapshotOverride function has been provided, we will provide a snapshot using that function rather than the default snapshot. This helps handle scenarios like Functional histograms where buckets aren't precomputed, so you cannot get ranges.

    Returns Record<number, number>

    A snapshot of the stored values.

Generated using TypeDoc