io.pedestal.tracing

added in 0.7.0

Wrappers around Open Telemetry tracing.

*context*

dynamic

The active OpenTelemetry context used as the parent of any created spans. If nil, then the span is created with the OpenTelemetry’s default current context.

This is designed to be bound when a span is created so that new spans created subsequently in other threads (typically, asynchronous execution) can connect to the appropriate context. In those cases, OpenTelemetry’s current context is not always accurate, as it is stored in a thread-local variable.

*tracing-source*

dynamic

add-attribute

(add-attribute span attribute-key attribute-value)

Adds an attribute to a span, typically, to record response attributes such as the status code. This should not be called after the span has ended.

as-root

(as-root builder)

Identifies the new span as a root span, with no parent. When this is not called, and span is active in the Open Telemetry context, the active span will be the parent of the new span when the span is started.

create-span

(create-span operation-name attributes)(create-span tracing-source operation-name attributes)

Creates a new span builder, which allows configuration of the span prior to starting it.

end-span

(end-span span)

Ends the span, which will set its termination time to current time. Every started span must be ended.

Returns nil.

make-context-current

(make-context-current context)

Makes the context the current context, returning a no-args function to close the scope (restoring the prior current scope).

make-span-context

(make-span-context span)

Creates a Context with the current context and the provided span.

record-exception

(record-exception span e)

rename-span

(rename-span span span-name)

set-status-code

(set-status-code span status-code)

Set the status code of the span to either :ok, :error, or :unset.

start

(start builder)

Builds the span from the span builder, starting and returning it.

with-kind

(with-kind builder kind)

Updates the span builder to label the new span with a kind (:internal, :server, :client, :producer, or :consumer).