metrizable

Wraps a LocalCommandBus with metrics collection capabilities. Returns a MetricLocalCommandBus that collects metrics on command operations.

Return

the metrizable local command bus


Wraps a DistributedCommandBus with metrics collection capabilities. Returns a MetricDistributedCommandBus that collects metrics on command operations.

Return

the metrizable distributed command bus


Wraps a LocalDomainEventBus with metrics collection capabilities. Returns a MetricLocalDomainEventBus that collects metrics on domain event operations.

Return

the metrizable local domain event bus


Wraps a DistributedDomainEventBus with metrics collection capabilities. Returns a MetricDistributedDomainEventBus that collects metrics on domain event operations.

Return

the metrizable distributed domain event bus


Wraps a LocalStateEventBus with metrics collection capabilities. Returns a MetricLocalStateEventBus that collects metrics on state event operations.

Return

the metrizable local state event bus


Wraps a DistributedStateEventBus with metrics collection capabilities. Returns a MetricDistributedStateEventBus that collects metrics on state event operations.

Return

the metrizable distributed state event bus


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

Return

the metrizable event store


Wraps a SnapshotStrategy with metrics collection capabilities. Returns a MetricSnapshotStrategy that collects metrics on snapshot strategy operations.

Return

the metrizable snapshot strategy


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

Return

the metrizable snapshot repository


Wraps a CommandHandler with metrics collection capabilities. Returns a MetricCommandHandler that collects metrics on command handling operations.

Return

the metrizable command handler


Wraps a SnapshotHandler with metrics collection capabilities. Returns a MetricSnapshotHandler that collects metrics on snapshot handling operations.

Return

the metrizable snapshot handler


Wraps a DomainEventHandler with metrics collection capabilities. Returns a MetricDomainEventHandler that collects metrics on domain event handling operations.

Return

the metrizable domain event handler


Wraps a StatelessSagaHandler with metrics collection capabilities. Returns a MetricStatelessSagaHandler that collects metrics on saga handling operations.

Return

the metrizable stateless saga handler


Wraps a ProjectionHandler with metrics collection capabilities. Returns a MetricProjectionHandler that collects metrics on projection handling operations.

Return

the metrizable projection handler


fun <T : Any> T.metrizable(): T

Automatically wraps supported Wow components with their corresponding metric decorators. This function inspects the type of the component and applies the appropriate metric wrapper if metrics are enabled and the component is not already metrizable.

Supported component types include:

  • Command buses (LocalCommandBus, DistributedCommandBus)

  • Event buses (LocalDomainEventBus, DistributedDomainEventBus, LocalStateEventBus, DistributedStateEventBus)

  • Event stores, snapshot repositories, and strategies

  • Various handlers (CommandHandler, DomainEventHandler, ProjectionHandler, etc.)

Components that are already Metrizable or not supported are returned unchanged.

Return

the component wrapped with metrics collection, or the original component if not applicable

Parameters

T

the type of the component


inline fun <T> T.metrizable(block: (T) -> T): T

Conditionally applies a metric decorator to a component based on configuration. This function checks if metrics are enabled and if the component is not already metrizable before applying the provided decoration block.

Return

the decorated component if metrics are enabled and component is not already metrizable, otherwise returns the original component

Parameters

T

the type of the component

block

the function that creates the metric decorator