Package-level declarations

Types

Link copied to clipboard

Bridges OpenTelemetrySpans into an AnalyticsClient as a generic otel_span_recorded event.

Link copied to clipboard

Discards every recorded span.

Link copied to clipboard
fun interface OpenTelemetryClient

Sink for OpenTelemetrySpans. Bridge this to a real tracer, or to AnalyticsClient.

Link copied to clipboard
data class OpenTelemetrySpan(val name: String, val kind: String, val status: String, val durationMs: Long, val attributes: Map<String, Any> = emptyMap())

Lightweight OpenTelemetry-shaped span, decoupled from any specific tracing SDK.

Link copied to clipboard
object SpanKind

OpenTelemetry span kinds, spelled as the spec's enum names.

Link copied to clipboard
object SpanStatus

OpenTelemetry span status codes, spelled as the spec's enum names.

Properties

Link copied to clipboard

Attribute key trace sets to the failing exception's class name, per OTel semantic conventions.

Functions

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.