correlatedOperation

inline suspend fun <T> correlatedOperation(operationName: String, attributes: Map<String, String> = emptyMap(), context: CoroutineContext = EmptyCoroutineContext, crossinline block: suspend () -> T): CorrelatedResult<T>

Execute a suspending operation with automatic correlation context and timing.

Creates or uses existing correlation context, records execution time, and provides structured result with metadata for logging and tracing.

Compliance (ISO 27001 A.12.4): All SDK operations should be wrapped with this function to enable audit trail correlation.

Return

CorrelatedResult with the operation result and metadata

Since

0.4.0

Parameters

operationName

Human-readable operation name for tracing

attributes

Additional attributes to include in context

context

Optional coroutine context for execution

block

The suspending operation to execute