Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Histogram

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

class Histogram<T extends string = string> {
constructor(configuration: HistogramConfiguration<T>);
get(): Promise<MetricObjectWithValues<MetricValueWithName<T>>>;
labels(...values: string[]): Histogram.Internal<T>;
labels(labels: LabelValues<T>): Histogram.Internal<T>;
observe(value: number): void;
observe(labels: LabelValues<T>, value: number): void;
remove(...values: string[]): void;
remove(labels: LabelValues<T>): void;
reset(): void;
startTimer(labels?: LabelValues<T>): (labels?: LabelValues<T>) => number;
zero(labels: LabelValues<T>): void;
}

§Type Parameters

§
T extends string = string
[src]

§Constructors

§
new Histogram(configuration: HistogramConfiguration<T>)
[src]
@param configuration

Configuration when creating the Histogram. Name and Help is mandatory

§Methods

§
get(): Promise<MetricObjectWithValues<MetricValueWithName<T>>>
[src]

Get histogram metric object

§
labels(...values: string[]): Histogram.Internal<T>
[src]

Return the child for given labels

@param values

Label values

@return

Configured histogram with given labels

labels(labels: LabelValues<T>): Histogram.Internal<T>
[src]

Return the child for given labels

@param labels

Object with label keys and values

@return

Configured counter with given labels

§
observe(value: number): void
[src]

Observe value

@param value

The value to observe

observe(labels: LabelValues<T>, value: number): void
[src]

Observe value for given labels

@param labels

Object with label keys and values

@param value

The value to observe

§
remove(...values: string[]): void
[src]

Remove metrics for the given label values

@param values

Label values

remove(labels: LabelValues<T>): void
[src]

Remove metrics for the given label values

@param labels

Object with label keys and values

§
reset(): void
[src]

Reset histogram values

§
startTimer(labels?: LabelValues<T>): (labels?: LabelValues<T>) => number
[src]

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

@param labels

Object with label keys and values

@return

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

§
zero(labels: LabelValues<T>): void
[src]

Initialize the metrics for the given combination of labels to zero