Skip to main content

nexus-observability-persistence

Persistence observability — tracing decorators for event, snapshot, and durable-state stores. Each decorator wraps the real store, opens an Internal span per operation, records duration metrics, and propagates store errors unmodified. Telemetry errors never break persistence.

Install​

terminal
composer require nexus-actors/observability-persistence

What's in this package​

ClassPurpose
TracingEventStoreDecorator for EventStore: spans persist, load, deleteUpTo, highestSequenceNr; counter nexus.persistence.events.persisted
TracingSnapshotStoreDecorator for SnapshotStore: spans save, load, delete; counter nexus.persistence.snapshots.saved
TracingDurableStateStoreDecorator for DurableStateStore: spans get, upsert, delete

All three decorators share the nexus.persistence.operation.duration histogram (seconds) with nexus.persistence.entity.type and operation dimensions.

Quick example​

src/Persistence/PersistenceSetup.php
use Monadial\Nexus\Observability\Persistence\TracingDurableStateStore;
use Monadial\Nexus\Observability\Persistence\TracingEventStore;
use Monadial\Nexus\Observability\Persistence\TracingSnapshotStore;

// Wrap the real stores with tracing decorators
$eventStore = new TracingEventStore($innerEventStore, $obs);
$snapshotStore = new TracingSnapshotStore($innerSnapshotStore, $obs);
$durableStateStore = new TracingDurableStateStore($innerDurableStateStore, $obs);

When $obs->isEnabled() returns false, each decorator calls the inner store directly with zero overhead.

Emitted spans and metrics​

NameKindDimensions
EventStore.persistInternal spannexus.persistence.entity.type, nexus.persistence.id, nexus.persistence.event.count
EventStore.loadInternal spannexus.persistence.entity.type, nexus.persistence.from_sequence_nr
SnapshotStore.saveInternal spannexus.persistence.entity.type, nexus.persistence.id
DurableStateStore.getInternal spannexus.persistence.entity.type, nexus.persistence.id
nexus.persistence.events.persistedCounternexus.persistence.entity.type
nexus.persistence.snapshots.savedCounternexus.persistence.entity.type
nexus.persistence.operation.durationHistogram (s)nexus.persistence.entity.type, operation

See also​