Liking cljdoc? Tell your friends :D

hive-ttracking.span

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

add-sampleclj

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

closeclj

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

closed?clj

(closed? span)

True iff span has :t1 set.

True iff span has :t1 set.
sourceraw docstring

descendant?clj

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

elapsed-msclj

(elapsed-ms span)

Milliseconds elapsed. See elapsed-ns. Returns nil if malformed.

Milliseconds elapsed. See elapsed-ns. Returns nil if malformed.
sourceraw docstring

elapsed-nsclj

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

ISpanSinkcljprotocol

flush!clj

(flush! this)

Force-flush any buffered spans. Returns Result.

Force-flush any buffered spans. Returns Result.

queryclj

(query this filter-fn)

Query stored spans by predicate. Returns Result.

Query stored spans by predicate. Returns Result.

record!clj

(record! this span)

Persist a closed Span. Returns Result.

Persist a closed Span. Returns Result.
source

noop-sinkclj

(noop-sink)
source

span->contextclj

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

tagclj

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

w3c-span-idclj

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

with-parentclj

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

with-trace-parentclj

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

with-trace-rootclj

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

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close