Package-level declarations

Types

Link copied to clipboard
abstract class AbstractTracer : Tracer

An abstract implementation of a tracer. By default, this class uses no-op implementations for all members unless overridden in a subclass.

Link copied to clipboard

An abstract implementation of a tracer provider. By default, this class uses no-op implementations for all members unless overridden in a subclass.

Link copied to clipboard
abstract class AbstractTraceSpan : TraceSpan

An abstract implementation of a trace span. By default, this class uses no-op implementations for all members unless overridden in a subclass.

Link copied to clipboard
interface SpanContext

The immutable state that must be serialized and propagated as part of a distributed trace context.

Link copied to clipboard

Indicates whether a span is a remote child or parent from the point of view of the instrumented code.

Link copied to clipboard

Indicates whether the operation/task represented by a span is known to be successful or not.

Link copied to clipboard
interface Tracer

Entry point for creating TraceSpan instances.

Link copied to clipboard
interface TracerProvider

The entry point for creating Tracer instances.

Link copied to clipboard
interface TraceSpan : Scope

Represents a single operation/task within a trace. Each trace contains a root span and optionally one or more child spans.

Link copied to clipboard
data class TraceSpanContext(val traceSpan: TraceSpan)

A CoroutineContext element that carries a TraceSpan.

Inherited properties

Link copied to clipboard
val <Error class: unknown class>.traceSpan: TraceSpan?

Gets the active TraceSpan from this CoroutineContext.

Functions

Link copied to clipboard
inline suspend fun <R> withSpan(span: TraceSpan, context: <Error class: unknown class> = EmptyCoroutineContext, crossinline block: suspend <Error class: unknown class>.(span: TraceSpan) -> R): R

Executes block within the scope of TraceSpan. The block of code is executed with a new coroutine context that contains the span set in the context.

inline suspend fun <T, R> withSpan(name: String, initialAttributes: <Error class: unknown class> = emptyAttributes(), spanKind: SpanKind = SpanKind.INTERNAL, context: <Error class: unknown class> = EmptyCoroutineContext, crossinline block: suspend <Error class: unknown class>.(span: TraceSpan) -> R): R

Creates a new TraceSpan and executes block within the scope of the new span. The block of code is executed with a new coroutine context that contains the newly created span set.

inline suspend fun <R> withSpan(sourceComponent: String, name: String, initialAttributes: <Error class: unknown class> = emptyAttributes(), spanKind: SpanKind = SpanKind.INTERNAL, context: <Error class: unknown class> = EmptyCoroutineContext, crossinline block: suspend <Error class: unknown class>.(span: TraceSpan) -> R): R

Creates a new TraceSpan using Tracer for sourceComponent and executes block within the scope of the new span. The block of code is executed with a new coroutine context that contains the newly created span set.

Inherited functions

Link copied to clipboard

Set common error attributes from an exception

Link copied to clipboard
fun <T : Any> TraceSpan.setAttribute(key: String, value: T)

Set an attribute on the span using a string key

Link copied to clipboard
inline suspend fun <R> Tracer.withSpan(name: String, initialAttributes: <Error class: unknown class> = emptyAttributes(), spanKind: SpanKind = SpanKind.INTERNAL, context: <Error class: unknown class> = EmptyCoroutineContext, crossinline block: suspend <Error class: unknown class>.(span: TraceSpan) -> R): R

Creates a new TraceSpan and executes block within the scope of the new span. The block of code is executed with a new coroutine context that contains the newly created span set.