Tracing support for instrumenting code.
Trace data is structured as events with a few special properties:
::trace/trace-id
The parent identifier for the overall trace of all linked events.::trace/span-id
A unique identifier for this event.::trace/parent-id
The span which is the parent of this one.::trace/keep?
A boolean to represent a sampling decision for events sent to ken on whether to keep or drop the spans of a trace.
false
means to discard a span. This decision will be propagated to child spans, but can be overridden later by a child span that decides to force keep.true
means to forcibly keep a span and all of its child spans, ignoring all other sampling decisions in the subtree.Additionally, trace events must have:
::event/time
This indicates the instant the span started.::event/duration
The duration (in milliseconds) the span covers.Tracing support for instrumenting code. Trace data is structured as events with a few special properties: - `::trace/trace-id` The parent identifier for the overall trace of all linked events. - `::trace/span-id` A unique identifier for this event. - `::trace/parent-id` The span which is the parent of this one. - `::trace/keep?` A boolean to represent a sampling decision for events sent to ken on whether to keep or drop the spans of a trace. - The absence of this key means the observed event will be kept and forwarded along. This is the default state. - `false` means to discard a span. This decision will be propagated to child spans, but can be overridden later by a child span that decides to force keep. - `true` means to forcibly keep a span and all of its child spans, ignoring all other sampling decisions in the subtree. Additionally, trace events must have: - `::event/time` This indicates the instant the span started. - `::event/duration` The duration (in milliseconds) the span covers.
Dynamic context holding the data for the current trace. When inside a span, this should be bound to an atom containing a map with event data.
Dynamic context holding the data for the current trace. When inside a span, this should be bound to an atom containing a map with event data.
(child-attrs)
(child-attrs data)
Return a map of trace attributes for a new child of the current span, if any. Generates a new trace-id and span-id as necessary.
Return a map of trace attributes for a new child of the current span, if any. Generates a new trace-id and span-id as necessary.
(current-data)
Return the current trace-id, span-id, and keep flag from the dynamic context, if any.
Return the current trace-id, span-id, and keep flag from the dynamic context, if any.
(current-span-id)
Return the current span-id from the trace context, if any.
Return the current span-id from the trace context, if any.
(current-trace-id)
Return the current trace-id from the trace context, if any.
Return the current trace-id from the trace context, if any.
(format-header data)
Construct a tracing header for inclusion in an HTTP request. Returns the constructed header string if the map of data provided has at least a trace-id and span-id.
DEPRECATED: Please switch to format-parent-header
Construct a tracing header for inclusion in an HTTP request. Returns the constructed header string if the map of data provided has at least a trace-id and span-id. DEPRECATED: Please switch to `format-parent-header`
(format-parent-header data)
Construct a tracing header for inclusion in an HTTP request. Returns the formatted header string if the map of data provided has the necessary information, otherwise nil.
Construct a tracing header for inclusion in an HTTP request. Returns the formatted header string if the map of data provided has the necessary information, otherwise nil. See: https://www.w3.org/TR/trace-context/
(gen-span-id)
Generate a new span identifier.
Generate a new span identifier.
(gen-trace-id)
Generate a new trace identifier.
Generate a new trace identifier.
Name of the header typically used to propagate Ken traces.
DEPRECATED: Please switch to parent-header-name
Name of the header typically used to propagate Ken traces. DEPRECATED: Please switch to `parent-header-name`
(maybe-sample event)
Apply sampling logic to the event, returning an updated event map.
Apply sampling logic to the event, returning an updated event map.
Name of the header used to propagate OpenTelemetry trace information.
Name of the header used to propagate OpenTelemetry trace information. See: https://www.w3.org/TR/trace-context/
(parse-header value)
Parse a tracing header from an HTTP request. Header values must start with
{version}-
. Returns a map of trace properties, or nil if the header is
absent or unrecognized.
DEPRECATED: Please switch to parse-parent-header
Parse a tracing header from an HTTP request. Header values must start with `{version}-`. Returns a map of trace properties, or nil if the header is absent or unrecognized. DEPRECATED: Please switch to `parse-parent-header`
(parse-parent-header value)
Parse a parent tracing header from an HTTP request. Header values must start
with {version}-
. Returns a map of trace properties, or nil if the header is
absent or unrecognized.
Parse a parent tracing header from an HTTP request. Header values must start with `{version}-`. Returns a map of trace properties, or nil if the header is absent or unrecognized.
(sample? sample-rate)
Randomly decide whether to keep or drop a span using the given rate. A result of false means drop and a result of true means keep.
Randomly decide whether to keep or drop a span using the given rate. A result of false means drop and a result of true means keep.
(with-data data & body)
Evaluate the body with the tracing state bound to the given data.
Evaluate the body with the tracing state bound to the given data.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close