BC-3 Spans — span sink abstraction + pure helpers over Span values.
Wave-2: helpers for closing/tagging/hierarchy. Sinks are Wave-3. See PLAN.md §2 BC-3.
STD-04 O1: span <-> W3C trace-context bridge (span->context, with-trace-parent) at the bottom; the codec is hive-ttracking.tracecontext. Trace fields ride in :tags under :w3c/trace-id, :w3c/span-id, :w3c/flags and :w3c/tracestate.
BC-3 Spans — span sink abstraction + pure helpers over Span values. Wave-2: helpers for closing/tagging/hierarchy. Sinks are Wave-3. See PLAN.md §2 BC-3. STD-04 O1: span <-> W3C trace-context bridge (span->context, with-trace-parent) at the bottom; the codec is hive-ttracking.tracecontext. Trace fields ride in :tags under :w3c/trace-id, :w3c/span-id, :w3c/flags and :w3c/tracestate.
(add-sample span k v)Append {:k k :v v :at nanoTime} onto the span's :samples vector.
Preserves insertion order.
Append `{:k k :v v :at nanoTime}` onto the span's :samples vector.
Preserves insertion order.(close span result)(close span result t1)Return a closed copy of span stamped with t1 (defaults to nanoTime) and
a result value. Pure — does not emit events or mutate sinks.
Return a closed copy of `span` stamped with t1 (defaults to nanoTime) and a result value. Pure — does not emit events or mutate sinks.
(descendant? maybe-child maybe-ancestor)True iff maybe-child claims maybe-ancestor as its direct parent.
Shallow (one-hop) — full-chain walks require an external index.
True iff `maybe-child` claims `maybe-ancestor` as its direct parent. Shallow (one-hop) — full-chain walks require an external index.
(elapsed-ms span)Milliseconds elapsed. See elapsed-ns. Returns nil if malformed.
Milliseconds elapsed. See elapsed-ns. Returns nil if malformed.
(elapsed-ns {:keys [t0 t1] :as _span})Nanoseconds from span open. Uses :t1 if closed, else nanoTime - :t0. Returns nil if span has no :t0 (malformed).
Nanoseconds from span open. Uses :t1 if closed, else nanoTime - :t0. Returns nil if span has no :t0 (malformed).
(flush! this)Force-flush any buffered spans. Returns Result.
Force-flush any buffered spans. Returns Result.
(query this filter-fn)Query stored spans by predicate. Returns Result.
Query stored spans by predicate. Returns Result.
(record! this span)Persist a closed Span. Returns Result.
Persist a closed Span. Returns Result.
(span->context {:keys [tags] :as span})W3C context whose parent-id is this span: what a hop leaving this span carries (traceparent header, _meta, TRACEPARENT env). nil when the span carries no valid :w3c/trace-id or has no usable wire id.
W3C context whose parent-id is this span: what a hop leaving this span carries (traceparent header, _meta, TRACEPARENT env). nil when the span carries no valid :w3c/trace-id or has no usable wire id.
(tag span tag-map)(tag span k v)Attach a tag (or merge a map of tags) onto a span. Returns updated span.
Attach a tag (or merge a map of tags) onto a span. Returns updated span.
(w3c-span-id {:keys [id tags]})This span's 16-hex wire id: the :w3c/span-id tag when valid, else the low 64 bits of a uuid :id. nil when neither yields a valid (non-zero) id.
This span's 16-hex wire id: the :w3c/span-id tag when valid, else the low 64 bits of a uuid :id. nil when neither yields a valid (non-zero) id.
(with-parent child parent)Return child with :parent-id bound to parent's :id. Accepts either a
Span record or a raw id keyword/uuid/string for parent.
Return `child` with :parent-id bound to `parent`'s :id. Accepts either a Span record or a raw id keyword/uuid/string for `parent`.
(with-trace-parent span ctx)Return span as a child of the remote context ctx: :parent-id becomes
ctx's parent-id (the caller's wire span id), and the trace-id, flags and
tracestate are copied into :tags. An invalid or nil ctx leaves the span
unchanged.
Return `span` as a child of the remote context `ctx`: :parent-id becomes ctx's parent-id (the caller's wire span id), and the trace-id, flags and tracestate are copied into :tags. An invalid or nil ctx leaves the span unchanged.
(with-trace-root span random-fn)Return span as the root of a new trace drawn from random-fn (see
tracecontext/new-root): trace-id and flags in :tags, no :parent-id
change. Unchanged when the source cannot produce a valid id.
Return `span` as the root of a new trace drawn from `random-fn` (see tracecontext/new-root): trace-id and flags in :tags, no :parent-id change. Unchanged when the source cannot produce a valid id.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |