Skip to content

MetricsExtension

Defined in: src/metrics/MetricsExtension.ts:25

MetricsExtension — the system.extension(MetricsExtensionId) accessor that hands back a MetricsRegistry. By default the extension creates a NoopMetricsRegistry (zero-cost) so framework instrumentation pays nothing when the user doesn’t enable metrics.

Opt in:

const metrics = system.extension(MetricsExtensionId).enable(); // … or pre-register a custom registry: system.extension(MetricsExtensionId).useRegistry(myCustomRegistry);

After enable(), the same system.extension(MetricsExtensionId) accessor returns the live DefaultMetricsRegistry; calls before that return the noop.

new MetricsExtension(_system): MetricsExtension

Defined in: src/metrics/MetricsExtension.ts:28

ActorSystem

MetricsExtension

enable(): MetricsRegistry

Defined in: src/metrics/MetricsExtension.ts:39

Replace the noop registry with a real one. Returns the live registry so callers can wire counters / gauges immediately. Idempotent — repeated calls return the same instance once a real registry is in place.

MetricsRegistry


get(): MetricsRegistry

Defined in: src/metrics/MetricsExtension.ts:31

Current registry — noop until enable() has been called.

MetricsRegistry


isEnabled(): boolean

Defined in: src/metrics/MetricsExtension.ts:56

True if a real (non-noop) registry is installed.

boolean


useRegistry(registry): void

Defined in: src/metrics/MetricsExtension.ts:51

Plug in a custom registry — useful when you want to share a single registry across multiple ActorSystems (rare) or to instrument with a third-party Prom client library directly.

MetricsRegistry

void