Liking cljdoc? Tell your friends :D

nl.jomco.ring-trace-context


*trace-context*clj

The trace-context in the current scope.

This will be set by wrap-trace-context automatically. Use with-context otherwise.

The trace-context in the current scope.

This will be set by `wrap-trace-context` automatically. Use
`with-context` otherwise.
sourceraw docstring

generate-traceparentclj

(generate-traceparent trace-context)

Returns a traceparent header value from the given trace-context.

Returns a traceparent header value from the given `trace-context`.
sourceraw docstring

get-contextclj

(get-context request-or-response)

Get the trace-context from the given ring request-or-response.

Will return nil if no traceparent header is present.

Get the trace-context from the given ring `request-or-response`.

Will return `nil` if no traceparent header is present.
sourceraw docstring

new-contextclj

(new-context)
(new-context base-trace-context)

Returns a new context off the given base-trace-context.

The returned trace-context has the same properties as the given base-trace-context but with a random :parent-id.

If base-trace-context is nil, returns a random context.

If no argument is passed, uses *trace-context* as the base.

Returns a new context off the given `base-trace-context`.

The returned trace-context has the same properties as the given
`base-trace-context` but with a random :parent-id.

If `base-trace-context` is `nil`, returns a random context.

If no argument is passed, uses `*trace-context*` as the base.
sourceraw docstring

new-spanclj

(new-span)
(new-span trace-context)

Same as new-context.

Same as `new-context`.
sourceraw docstring

parse-traceparentclj

(parse-traceparent traceparent)

Parse traceparent string and return a trace-context map.

This will fully parse version "00" traceparent values.

trace-context map contains :version, :trace-id, :parent-id and :trace-flags (a set of keywords).

The only currently supported trace-flag is :sampled.

Returns nil if traceparent is not a valid traceparent value.

See also https://www.w3.org/TR/trace-context

Parse `traceparent` string and return a trace-context map.


This will fully parse version "00" traceparent values.

trace-context map contains :version, :trace-id, :parent-id
and :trace-flags (a set of keywords).

The only currently supported trace-flag is :sampled.

Returns `nil` if `traceparent` is not a valid traceparent value.

See also https://www.w3.org/TR/trace-context
sourceraw docstring

parse-tracestateclj

(parse-tracestate s)
source

random-contextclj

(random-context)

Create new random trace-context.

:trace-id and :parent-id are random. :version is always 00 and :trace-flags are empty.

Create new random trace-context.

:trace-id and :parent-id are random. :version is always 00
and :trace-flags are empty.
sourceraw docstring

set-contextclj

(set-context request-or-response trace-context)

Set the traceparent header for trace-context on request-or-response.

Set the traceparent header for `trace-context` on `request-or-response`.
sourceraw docstring

with-contextcljmacro

(with-context trace-context & body)

Bind trace-context to trace-context and evaluate body.

Bind *trace-context* to `trace-context` and evaluate `body`.
sourceraw docstring

wrap-trace-contextclj

(wrap-trace-context handler)

Ring middleware for Trace Context.

Implements the W3C Trace Context protocol. When a request has a traceparent header, this gets parsed into a trace-context which is set on the request, before passing it to handler.

The parsed trace-context is set on the request and response as the :trace-context key.

If no traceparent is set, or traceparent is not valid, a new random trace-context is created.

Sets the response traceparent header to the trace-context used.

During call to handler, *trace-context* is also bound to trace-context.

See https://www.w3.org/TR/trace-context/

Ring middleware for Trace Context.

Implements the W3C Trace Context protocol.  When a request has a
`traceparent` header, this gets parsed into a `trace-context` which
is set on the request, before passing it to `handler`.

The parsed `trace-context` is set on the request and response as the
`:trace-context` key.

If no `traceparent` is set, or `traceparent` is not valid, a new
random `trace-context` is created.

Sets the response `traceparent` header to the trace-context used.

During call to `handler`, `*trace-context*` is also bound to
`trace-context`.

See  https://www.w3.org/TR/trace-context/
sourceraw docstring

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

× close