Represents a single metric value that can be tracked and accumulated.
Metrics can store any type of value and support addition operations for numbers and arrays. Used within the tracing system to collect performance data and custom measurements.
const counter = new Metric<number>('/api/requests');counter.set(0);counter.add(1);counter.add(5);console.log(counter.value); // 6 Copy
const counter = new Metric<number>('/api/requests');counter.set(0);counter.add(1);counter.add(5);console.log(counter.value); // 6
The type of the metric value
Optional
Readonly
Represents a single metric value that can be tracked and accumulated.
Metrics can store any type of value and support addition operations for numbers and arrays. Used within the tracing system to collect performance data and custom measurements.
Example