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

Gauge

A gauge is a metric that represents a single numerical value that can arbitrarily go up and down.

class Gauge<T extends string = string> {
constructor(configuration: GaugeConfiguration<T>);
dec(labels: LabelValues<T>, value?: number): void;
dec(value?: number): void;
get(): Promise<MetricObjectWithValues<MetricValue<T>>>;
inc(labels: LabelValues<T>, value?: number): void;
inc(value?: number): void;
labels(...values: string[]): Gauge.Internal<T>;
labels(labels: LabelValues<T>): Gauge.Internal<T>;
remove(...values: string[]): void;
remove(labels: LabelValues<T>): void;
reset(): void;
set(labels: LabelValues<T>, value: number): void;
set(value: number): void;
setToCurrentTime(labels?: LabelValues<T>): void;
startTimer(labels?: LabelValues<T>): (labels?: LabelValues<T>) => number;
}

§Type Parameters

§
T extends string = string
[src]

§Constructors

§
new Gauge(configuration: GaugeConfiguration<T>)
[src]
@param configuration

Configuration when creating a Gauge metric. Name and Help is mandatory

§Methods

§
dec(labels: LabelValues<T>, value?: number): void
[src]

Decrement gauge

@param labels

Object with label keys and values

@param value

Value to decrement with

dec(value?: number): void
[src]

Decrement gauge

@param value

The value to decrement with

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

Get gauge metric object

§
inc(labels: LabelValues<T>, value?: number): void
[src]

Increment gauge for given labels

@param labels

Object with label keys and values

@param value

The value to increment with

inc(value?: number): void
[src]

Increment gauge

@param value

The value to increment with

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

Return the child for given labels

@param values

Label values

@return

Configured gauge with given labels

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

Return the child for given labels

@param labels

Object with label keys and values

@return

Configured counter with given labels

§
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 gauge values

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

Set gauge value for labels

@param labels

Object with label keys and values

@param value

The value to set

set(value: number): void
[src]

Set gauge value

@param value

The value to set

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

Set gauge value to current epoch time in ms

@param labels

Object with label keys and values

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

Start a timer. Calling the returned function will set the gauge's value to the observed duration in seconds.

@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.