An interface for bucketing algorithms for histograms.

It's responsible to calculate the bucket a sample goes into. It can calculate buckets on-the-fly or pre-calculate buckets and re-use that when needed.

Implements

Constructors

Properties

exponent: number

Methods

  • Determines the minimum value of a bucket, given a bucket index.

    Parameters

    • index: number

      The index to find the min value for.

    Returns number

    The minimum value of the bucket.

  • Maps a sample to a "bucket index" that it belongs in.

    A "bucket index" is the consecutive integer index of each bucket, useful as a mathematical concept, even though the internal representation is stored and sent using the minimum value in each bucket.

    Parameters

    • sample: number

      The sample to map to a bucket index.

    Returns number

    The bucket index for the sample.

  • Gets a snapshot of all contiguous values.

    Caution This is a more specific implementation of snapshotValues on functional histograms. snapshotValues cannot be used with those, due to buckets not being precomputed.

    Parameters

    • values: Record<number, number>

      All the current histogram values.

    Returns Record<number, number>

    Updated values with anything missing replaced with a default value of 0.

Generated using TypeDoc