Skip to main content

Metrics

Nexus OTel observability exposes metrics via the OpenTelemetry SDK. All metrics are exported via the configured OTLP exporter. Prometheus pull mode is also supported by running an otel-collector that scrapes the OTLP receiver and exposes a /metrics endpoint.

Actor system

NameTypeUnitKey DimensionsDescription
nexus.actor.messages.processedCounter{message}nexus.message.typeMessages successfully processed by an actor
nexus.actor.message.processing.durationHistogrammsnexus.message.typeTime from mailbox dequeue to handler return

Actor system state

Requires nexus-observability-actor with ActorSystemMetrics registered.

NameTypeUnitDescription
nexus.actor_system.live_actorsObservable Gauge{actor}Number of live root actors in the system
nexus.actor_system.dead_lettersObservable Gauge{message}Total dead-lettered messages captured by the system
nexus.actor_system.runningObservable Gauge{system}Whether the actor system runtime is running (1) or not (0)

HTTP server

Requires nexus-observability-http with ServerSpanMiddleware and HttpMetricsListener registered.

NameTypeUnitKey DimensionsDescription
http.server.request.durationHistogramshttp.request.method, http.response.status_codeEnd-to-end HTTP request duration
http.server.active_requestsUpDownCounter{request}http.request.methodNumber of in-flight HTTP server requests

Persistence

Requires nexus-observability-persistence with TracingEventStore, TracingSnapshotStore, and/or TracingDurableStateStore wrappers.

NameTypeUnitKey DimensionsDescription
nexus.persistence.events.persistedCounter{event}nexus.persistence.entity.typeEvents written to the event store
nexus.persistence.snapshots.savedCounter{snapshot}nexus.persistence.entity.typeSnapshots written to the snapshot store
nexus.persistence.operation.durationHistogramsnexus.persistence.entity.type, operationDuration of persistence store operations

The nexus.persistence.entity.type dimension uses the entity type portion of the PersistenceId (e.g., Order from PersistenceId::of('Order', $id)), keeping cardinality fixed regardless of how many entity instances exist.

Worker pool

Requires nexus-observability-worker-pool with TracingWorkerTransport installed.

NameTypeUnitKey DimensionsDescription
nexus.worker_pool.messages.sentCounter{message}nexus.worker.targetMessages sent across worker threads
nexus.worker_pool.send.durationHistogramsnexus.worker.targetDuration of cross-worker transport sends

DBAL connection pool

Requires nexus-observability-doctrine with DbalPoolMetricsListener registered.

NameTypeUnitKey DimensionsDescription
nexus.dbal.pool.connections.createdCounter{connection}pool.nameConnections created in the pool
nexus.dbal.pool.connections.takenCounter{connection}pool.nameConnections checked out from the pool
nexus.dbal.pool.connections.releasedCounter{connection}pool.nameConnections returned to the pool
nexus.dbal.pool.connections.destroyedCounter{connection}pool.nameConnections removed from the pool
nexus.dbal.pool.connections.poisonedCounter{connection}pool.nameConnections poisoned (unusable) and removed
nexus.dbal.pool.exhaustedCounter{connection}pool.namePool-exhausted events (acquire blocked)
nexus.dbal.pool.acquire.waitHistogramspool.nameTime spent waiting to acquire a pooled connection

Doctrine ORM pool

Requires nexus-observability-doctrine with OrmPoolMetricsListener registered.

NameTypeUnitKey DimensionsDescription
nexus.orm.pool.entity_managers.createdCounter{entity_manager}pool.nameEntity managers created in the pool
nexus.orm.pool.entity_managers.clearedCounter{entity_manager}pool.nameEntity managers cleared and returned to the pool
nexus.orm.pool.entity_managers.evictedCounter{entity_manager}pool.nameEntity managers evicted from the pool

Swoole runtime

Requires nexus-observability-swoole with SwooleAdminMetrics registered in each worker.

NameTypeUnitDescription
swoole.coroutine.countObservable Gauge{coroutine}Number of running Swoole coroutines
swoole.coroutine.peakObservable Gauge{coroutine}Peak number of concurrent Swoole coroutines
swoole.server.connectionsObservable Gauge{connection}Active Swoole server connections
swoole.server.requestsObservable Gauge{request}Total requests handled by the Swoole server
swoole.server.workers.idleObservable Gauge{worker}Idle Swoole worker processes

Cardinality guidance

tip

The nexus.message.type dimension uses the message class short name (e.g., PlaceOrder), not the FQCN. Similarly, nexus.persistence.entity.type uses only the entity-type prefix of a PersistenceId, keeping cardinality bounded regardless of how many entity instances exist.

Never add user IDs, session IDs, or request IDs to built-in metric dimensions. Each unique combination of dimension values creates a new time series in your metrics backend. High-cardinality dimensions cause storage and query problems at scale.

For per-entity or per-user analysis, use traces (which carry high-cardinality data in span attributes) rather than metrics.