Liking cljdoc? Tell your friends :D

ken.trace

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.
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.
raw docstring

*data*clj/s

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.
sourceraw docstring

child-attrsclj/s

(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.
sourceraw docstring

current-dataclj/s

(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.
sourceraw docstring

current-span-idclj/s

(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.
sourceraw docstring

current-trace-idclj/s

(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.
sourceraw docstring

format-headerclj/s

(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.

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.
sourceraw docstring

gen-span-idclj/s

(gen-span-id)

Generate a new span identifier.

Generate a new span identifier.
sourceraw docstring

gen-trace-idclj/s

(gen-trace-id)

Generate a new trace identifier.

Generate a new trace identifier.
sourceraw docstring

header-nameclj/s

Name of the header typically used to propagate Ken traces.

Name of the header typically used to propagate Ken traces.
sourceraw docstring

maybe-sampleclj/s

(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.
sourceraw docstring

parse-headerclj/s

(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.

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.
sourceraw docstring

sample?clj/s

(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.
sourceraw docstring

with-dataclj/smacro

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close