MetricSnapshotRepository

Metric decorator for snapshot repositories that collects metrics on snapshot storage and retrieval operations. This class wraps a SnapshotRepository implementation and adds metrics collection with tags for aggregate name and source identification to track snapshot repository performance.

Constructors

Link copied to clipboard
constructor(delegate: SnapshotRepository)

Properties

Link copied to clipboard

the original component being decorated, must implement the Decorator interface

Link copied to clipboard
open override val name: String

The name of the snapshot repository. This delegates to the underlying snapshot repository implementation.

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 getVersion(aggregateId: AggregateId): Mono<Int>

Gets the version of the latest snapshot for the specified aggregate ID and collects metrics on the operation. Metrics collected include timing and tags for aggregate identification.

Link copied to clipboard
open override fun <S : Any> load(aggregateId: AggregateId): Mono<Snapshot<S>>

Loads a snapshot for the specified aggregate ID and collects metrics on the operation. Metrics collected include timing, success/failure rates, and tags for aggregate identification.

Link copied to clipboard

Wraps a SnapshotRepository with metrics collection capabilities. Returns a MetricSnapshotRepository that collects metrics on snapshot storage operations.

Link copied to clipboard
open override fun <S : Any> save(snapshot: Snapshot<S>): Mono<Void>

Saves a snapshot 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 scanAggregateId(namedAggregate: NamedAggregate, afterId: String, limit: Int): Flux<AggregateId>

Scans for aggregate IDs in the snapshot repository starting after the specified ID and collects metrics on the operation. Metrics collected include timing and tags for aggregate identification.

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.