TelemetrySpan

interface TelemetrySpan

A timed unit of work reported to the installed TelemetrySink.

Obtain one from Telemetry.startSpan and always stop it — preferably from a finally block, or by using traced, which stops the span for you.

Implementations must be safe to call from any thread and must never throw.

Functions

Link copied to clipboard
abstract fun putAttribute(name: String, value: String)

Attaches a low-cardinality label to this span, such as an outcome or a host name.

Link copied to clipboard
abstract fun putMetric(name: String, value: Long)

Attaches a numeric measurement to this span, such as a byte count or a retry count.

Link copied to clipboard
abstract fun stop()

Ends the span and reports its duration. Calling this more than once has no effect.