MetricsExtension
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Defined in: src/metrics/MetricsExtension.ts:30
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 raise / disable the per-family cardinality cap: const metricsOptions = MetricsRegistryOptions.create().withMaxSeriesPerFamily(50_000); system.extension(MetricsExtensionId).enable(metricsOptions); // … 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.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MetricsExtension(
_system):MetricsExtension
Defined in: src/metrics/MetricsExtension.ts:39
Parameters
Section titled “Parameters”_system
Section titled “_system”Returns
Section titled “Returns”MetricsExtension
Methods
Section titled “Methods”disable()
Section titled “disable()”disable():
void
Defined in: src/metrics/MetricsExtension.ts:84
Go back to the noop registry, discarding whatever was collected.
Mirrors TracingExtension.disable(), and lets a tool that switched
metrics on for its own use (DevTools does) leave the system as it
found it.
Returns
Section titled “Returns”void
enable()
Section titled “enable()”enable(
options?):MetricsRegistry
Defined in: src/metrics/MetricsExtension.ts:51
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, so options only takes effect on the call
that actually installs the registry.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”get():
MetricsRegistry
Defined in: src/metrics/MetricsExtension.ts:42
Current registry — noop until enable() has been called.
Returns
Section titled “Returns”isEnabled()
Section titled “isEnabled()”isEnabled():
boolean
Defined in: src/metrics/MetricsExtension.ts:74
True if a real (non-noop) registry is installed.
Returns
Section titled “Returns”boolean
useRegistry()
Section titled “useRegistry()”useRegistry(
registry):void
Defined in: src/metrics/MetricsExtension.ts:64
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.
Parameters
Section titled “Parameters”registry
Section titled “registry”Returns
Section titled “Returns”void
