opentracing-clj.core

Functions for creating and manipulating spans for opentracing.

*tracer*

dynamic

An Tracer object representing the standard tracer for trace operations.

Defaults to the value returned by GlobalTracer.get().

activate

(activate span)

Activates a span.

active-span

(active-span)

Returns the current active span.

baggage-item

(baggage-item key)(baggage-item span key)

Returns the value of the baggage item identified by the given key, or nil if no such item could be found.

context

(context)(context span)

Returns the associated SpanContext of a span.

finish

(finish)(finish span)(finish span timestamp)

Sets the end timestamp to now and records the span. Can also supply an explicit timestamp in microseconds.

log

(log v)(log span v)(log span v timestamp)

Logs value v on the span.

Can also supply an explicit timestamp in microseconds.

scope-manager

(scope-manager)(scope-manager tracer)

Returns the ScopeManager of the tracer.

set-baggage-item

(set-baggage-item key val)(set-baggage-item span key val)

Sets a baggage item on the Span as a key/value pair.

set-baggage-items

(set-baggage-items map)(set-baggage-items span map)

Sets baggage items on the Span using key/value pairs of a map.

Note: Will automatically convert keys into strings.

set-operation-name

(set-operation-name name)(set-operation-name span name)

Sets the string name for the logical operation this span represents.

set-tag

(set-tag key value)(set-tag span key value)

Sets a key/value tag on the Span.

set-tags

(set-tags m)(set-tags s m)

Sets/adds tags on the Span using key/value pairs of a map.

Automatically converts keys into strings. Overrides any existing tags with the same keys.

with-active-span

macro

(with-active-span sym & body)

Convenience macro for setting sym to the current active span. Will evaluate to nil if there are no active-spans.

with-span

macro

(with-span binding & body)

Evaluates body in the scope of a generated span.

binding => [span-sym span-init-spec]

span-init-spec must evaluate at runtime to a value conforming to the :opentracing/span-init spec.