MetricEventStore

Metric decorator for event stores that collects metrics on event storage and retrieval operations. This class wraps an EventStore implementation and adds metrics collection with tags for aggregate name and source identification to track event store performance.

Constructors

Link copied to clipboard
constructor(delegate: EventStore)

Properties

Link copied to clipboard
override val delegate: EventStore

the original component being decorated, must implement the Decorator interface

Link copied to clipboard

The source identifier derived from the original delegate's class name. This is used for metrics tagging to identify the component type.

Functions

Link copied to clipboard
open override fun append(eventStream: DomainEventStream): Mono<Void>

Appends a domain event stream to the event store and collects metrics on the operation. Metrics collected include timing, success/failure rates, and tags for aggregate identification.

Link copied to clipboard
open override fun load(aggregateId: AggregateId, headVersion: Int, tailVersion: Int): Flux<DomainEventStream>

Loads domain event streams for the specified aggregate ID within the given version range and collects metrics on the operation. Metrics collected include timing and tags for aggregate identification.

open override fun load(aggregateId: AggregateId, headEventTime: Long, tailEventTime: Long): Flux<DomainEventStream>

Loads domain event streams for the specified aggregate ID within the given time range and collects metrics on the operation. Metrics collected include timing and tags for aggregate identification.

Link copied to clipboard

Wraps an EventStore with metrics collection capabilities. Returns a MetricEventStore that collects metrics on event storage operations.

Link copied to clipboard
fun <M> Flux<M>.tagSource(): Flux<M>

Extension function to tag a Flux publisher with the current source identifier. This adds the source tag to metrics collected from this reactive stream.

fun <M> Mono<M>.tagSource(): Mono<M>

Extension function to tag a Mono publisher with the current source identifier. This adds the source tag to metrics collected from this reactive stream.