exportToOpenTelemetry

fun SharedFlow<ResilientEvent>.exportToOpenTelemetry(meter: Meter, scope: CoroutineScope = GlobalScope): Job

Exports ResilientEvent telemetry from this SharedFlow to OpenTelemetry metrics.

Each event type is mapped to a named OTel counter. The collection runs in the provided scope as a background coroutine; cancel the returned Job to stop processing.

Return

A Job for the background collection coroutine. Cancel it to stop exporting.

Parameters

meter

The OTel Meter used to build and record counters.

scope

The CoroutineScope that drives the collection coroutine. Defaults to GlobalScope; prefer passing an explicit scope to control lifecycle.