AnalyticsOpenTelemetryClient

Bridges OpenTelemetrySpans into an AnalyticsClient as a generic otel_span_recorded event.

Constructors

Link copied to clipboard
constructor(analyticsClient: AnalyticsClient)

Functions

Link copied to clipboard
open override fun recordSpan(span: OpenTelemetrySpan)
Link copied to clipboard
inline fun <T> OpenTelemetryClient.trace(name: String, kind: String = SpanKind.INTERNAL, attributes: Map<String, Any> = emptyMap(), block: () -> T): T

Times block and records it as a span: SpanStatus.OK on success, SpanStatus.ERROR (with ERROR_TYPE_ATTRIBUTE) when it throws. Cancellation is recorded as SpanStatus.UNSET, since a cancelled operation did not fail. The exception is always rethrown. Sink failures are ignored so recording cannot change the result or replace the original exception. The inline block also supports suspending calls from a coroutine.