(append-cid cid segment)Appends a segment, or returns the cid unchanged when the result would exceed the cap.
Appends a segment, or returns the cid unchanged when the result would exceed the cap.
(child-ctx ctx)Create a child ctx under the given ctx (or a new root ctx if nil). The child appends its span to the cid, so a prefix query sees the whole request and the full id narrows to a hop.
Create a child ctx under the given ctx (or a new root ctx if nil). The child appends its span to the cid, so a prefix query sees the whole request and the full id narrows to a hop.
(decode-ctx s)Decode ctx from a string like: t=...;s=...;p=...;c=... Returns nil when parsing fails.
Decode ctx from a string like: t=...;s=...;p=...;c=... Returns nil when parsing fails.
(encode-ctx {:keys [trace-id span-id parent-span-id cid]})Encode ctx into a compact string suitable for headers and metadata:
t=<trace-id>;s=<span-id>;p=<parent>;c=<cid>.
Encode ctx into a compact string suitable for headers and metadata: `t=<trace-id>;s=<span-id>;p=<parent>;c=<cid>`.
(ensure-ctx ctx)Ensure we have a base context. Creates a root ctx if nil, and gives a ctx its cid when it predates the cid field (or arrived without one).
Ensure we have a base context. Creates a root ctx if nil, and gives a ctx its cid when it predates the cid field (or arrived without one).
Upper bound for a correlation id. Each hop appends a segment, so a retry chain would otherwise grow without limit; at the cap the id stops growing and stays queryable.
Upper bound for a correlation id. Each hop appends a segment, so a retry chain would otherwise grow without limit; at the cap the id stops growing and stays queryable.
Room left for the request id and at least one hop after a business prefix.
Room left for the request id and at least one hop after a business prefix.
(new-span-id)Short span id for a single hop.
Short span id for a single hop.
(new-trace-id)Short trace id for an entire request history.
Short trace id for an entire request history.
(request-cid app use-case)Conventional root for a request CID: <app>.<use-case>.REQ (e.g. APPX.SIGNIN.REQ).
The originator owns this value -- it names the application and the use case, which
is what makes a prefix query meaningful (APPX.SIGNIN = every sign-in request of that
app). Services adopt it and append; they never invent it.
Conventional root for a request CID: `<app>.<use-case>.REQ` (e.g. `APPX.SIGNIN.REQ`). The **originator** owns this value -- it names the application and the use case, which is what makes a prefix query meaningful (`APPX.SIGNIN` = every sign-in request of that app). Services adopt it and append; they never invent it.
(sanitize-cid s)A business prefix safe in a header and as a dotted path: [A-Za-z0-9._-], no leading or
trailing separators, capped so there is room for a request id and a hop.
A business prefix safe in a header and as a dotted path: `[A-Za-z0-9._-]`, no leading or trailing separators, capped so there is room for a request id and a hop.
(with-ctx ctx & body)Bind tracing context for the duration of body.
Bind tracing context for the duration of body.
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 |