trackedOperation

inline suspend fun <T> trackedOperation(operationName: String, attributes: Map<String, String> = emptyMap(), crossinline onSuccess: (T, String, Long) -> Unit = { _, _, _ -> }, crossinline onFailure: (Throwable, String, Long) -> Unit = { _, _, _ -> }, crossinline block: suspend () -> T): T

Execute a suspending operation with correlation, automatically recording success/failure to an optional callback.

Return

The operation result (throws on failure)

Since

0.4.0

Parameters

operationName

Human-readable operation name

attributes

Additional attributes for context

onSuccess

Called on successful completion with result and timing

onFailure

Called on exception with error and timing

block

The suspending operation to execute