Class Histogram<T>

A histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets

Type Parameters

  • T extends string = string

Hierarchy

  • Histogram

Constructors

  • Type Parameters

    • T extends string = string

    Parameters

    • configuration: HistogramConfiguration<T>

      Configuration when creating the Histogram. Name and Help is mandatory

    Returns Histogram<T>

Methods

  • Get histogram metric object

    Returns Promise<MetricObjectWithValues<MetricValueWithName<T>>>

  • Return the child for given labels

    Parameters

    • Rest ...values: string[]

      Label values

      Rest

    Returns Histogram.Internal<T>

    Configured histogram with given labels

  • Return the child for given labels

    Parameters

    • labels: Partial<Record<T, string | number>>

      Object with label keys and values

    Returns Histogram.Internal<T>

    Configured counter with given labels

  • Observe value

    Parameters

    • value: number

      The value to observe

    Returns void

  • Observe value for given labels

    Parameters

    • labels: Partial<Record<T, string | number>>

      Object with label keys and values

    • value: number

      The value to observe

    Returns void

  • Remove metrics for the given label values

    Parameters

    • Rest ...values: string[]

      Label values

      Rest

    Returns void

  • Remove metrics for the given label values

    Parameters

    • labels: Partial<Record<T, string | number>>

      Object with label keys and values

    Returns void

  • Reset histogram values

    Returns void

  • Start a timer. Calling the returned function will observe the duration in seconds in the histogram.

    Parameters

    • Optional labels: Partial<Record<T, string | number>>

      Object with label keys and values

      Optional

    Returns ((labels?) => number)

    Function to invoke when timer should be stopped. The value it returns is the timed duration.

      • (labels?): number
      • Start a timer. Calling the returned function will observe the duration in seconds in the histogram.

        Parameters

        • Optional labels: Partial<Record<T, string | number>>

          Object with label keys and values

          Optional

        Returns number

        Function to invoke when timer should be stopped. The value it returns is the timed duration.

  • Initialize the metrics for the given combination of labels to zero

    Parameters

    • labels: Partial<Record<T, string | number>>

    Returns void

Generated using TypeDoc