Skip to main content
Version: 2.0.0

Class: Metrics

Abstract class representing a metrics system. Provides methods to interact with various types of metrics like counters. This class should not be instantiated directly. Instead, use the internal constant metrics to access the methods.

Methods

getCounter()

static getCounter(name): Counter

Retrieves a counter metric by name. A counter is a metric that can be incremented or decremented to track counts. You access it using the internal constant metrics.

Parameters

name: string

The name of the counter metric.

Returns

Counter

A Counter instance associated with the given name.

Example

// Retrieve a counter named 'Counter.Workflow.*.Instances'
const signalCount = metrics.getCounter('Counter.Signals.*.MyCounter');

// Increment the counter by 1
signalCount.increment();

// Decrement the counter by 1
signalCount.decrement();