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

Counter

A counter is a cumulative metric that represents a single numerical value that only ever goes up

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

§Type Parameters

§
T extends string = string
[src]

§Constructors

§
new Counter(configuration: CounterConfiguration<T>)
[src]
@param configuration

Configuration when creating a Counter metric. Name and Help is required.

§Methods

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

Get counter metric object

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

Increment for given labels

@param labels

Object with label keys and values

@param value

The number to increment with

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

Increment with value

@param value

The value to increment with

§
labels(...values: string[]): Counter.Internal
[src]

Return the child for given labels

@param values

Label values

@return

Configured counter with given labels

labels(labels: LabelValues<T>): Counter.Internal
[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 counter values