Skip to content

InMemoryMetricsCollector

Defined in: src/observability/metrics.ts:70

In-memory metrics collector for testing, development, and admin API.

Accumulates counters, histograms, and gauges in plain arrays/maps. Not intended for high-throughput production use — prefer shipping metrics to a dedicated backend for production workloads.

new InMemoryMetricsCollector(): InMemoryMetricsCollector

InMemoryMetricsCollector

gauge(name, value, tags?): void

Defined in: src/observability/metrics.ts:105

Set a gauge to an absolute value.

string

number

Record<string, string>

void

MetricsCollector.gauge


histogram(name, value, tags?): void

Defined in: src/observability/metrics.ts:90

Record a histogram observation.

string

number

Record<string, string>

void

MetricsCollector.histogram


increment(name, value?, tags?): void

Defined in: src/observability/metrics.ts:75

Increment a counter by value (default 1).

string

number = 1

Record<string, string>

void

MetricsCollector.increment


reset(): void

Defined in: src/observability/metrics.ts:135

Reset all metrics to zero.

void

MetricsCollector.reset


snapshot(): MetricsSnapshot

Defined in: src/observability/metrics.ts:115

Return a point-in-time snapshot of all metrics.

MetricsSnapshot

MetricsCollector.snapshot