Before tracing you should set a sender fn passing it to set-sender!. The default sender does nothing.
IMPORTANT: Start time is captured in microseconds as System/currentTimeMillis * 1000. Duration time is measured in microseconds as a difference between System/nanoTime devided by 1000.
Before tracing you should set a sender fn passing it to set-sender!. The default sender does nothing. IMPORTANT: Start time is captured in microseconds as System/currentTimeMillis * 1000. Duration time is measured in microseconds as a difference between System/nanoTime devided by 1000.
(annotate span & annotations)
Adds annotations
with the current timestamp to span
.
annotations
is a sequence of strings.
Returns the updated span.
Adds `annotations` with the current timestamp to `span`. `annotations` is a sequence of strings. Returns the updated span.
(annotate! & annotations)
Adds annotations
with the current timestamp to the current span
.
If there is no current span, does nothing.
Returns the updated span.
See annotate
.
Adds `annotations` with the current timestamp to the current `span`. If there is no current span, does nothing. Returns the updated span. See `annotate`.
(child-span opts)
Creates a span with the current timestamp and the current span as the parent. Returns the created span.
See span
for the list of options.
Creates a span with the current timestamp and the current span as the parent. Returns the created span. See `span` for the list of options.
(child-trace! opts & body)
Executes body
setting the current span to a newly created span with
the current span as its parent. If there is no current span, creates
a root span. Passes the created span (possibly updated during the body
execution) to send-span!
before returning.
Returns the body execution result.
See span
for the list of options.
Note: recur
cannot cross child-trace!
boundaries.
Executes `body` setting the current span to a newly created span with the current span as its parent. If there is no current span, creates a root span. Passes the created span (possibly updated during the body execution) to `send-span!` before returning. Returns the body execution result. See `span` for the list of options. Note: `recur` cannot cross `child-trace!` boundaries.
(configure! & {:keys [sender storage endpoint] :as opts})
Allows setting all tracing parameters at once.
opts
is a map with the following keys:
:sender
- a sender function,:storage
- a zipkin-clj.core/ISpanStorage
implementation,:endpoint
- an endpoint description mapReturned value is not specified.
See set-sender!
, set-storage!
, set-endpoint!
.
Allows setting all tracing parameters at once. `opts` is a map with the following keys: - `:sender` - a sender function, - `:storage` - a `zipkin-clj.core/ISpanStorage` implementation, - `:endpoint` - an endpoint description map Returned value is not specified. See `set-sender!`, `set-storage!`, `set-endpoint!`.
(current-span)
Returns the current span or nil
if none.
Returns the current span or `nil` if none.
(externalize span)
Prepares span
for serialization before sending to Zipkin.
Prepares `span` for serialization before sending to Zipkin.
(finish-span span)
Adds duration to the span calculating it as a difference between the current time and the start time. Does nothing if span has no start time. Returns the updated span.
Adds duration to the span calculating it as a difference between the current time and the start time. Does nothing if span has no start time. Returns the updated span.
(get-span this)
Returns the current span or nil if absent.
Returns the current span or nil if absent.
(pop-span! this)
Sets the current span to the previous value (as it was before push-span!) Returns the current span.
Sets the current span to the previous value (as it was before push-span!) Returns the current span.
(push-span! this span)
Sets span as the current. Returns the updated span.
Sets span as the current. Returns the updated span.
(update-span! this f)
Sets the current span to (f current-span). If there is no current span does nothing. Returns the updated value. All changes made by f must be commutative.
Sets the current span to (f current-span). If there is no current span does nothing. Returns the updated value. All changes made by f must be commutative.
(send-span! span)
If sampling decision for span
evaluates to true, passes
externalized span to the sender.
Returned value is not specified.
See set-sender!
.
If sampling decision for `span` evaluates to true, passes externalized span to the sender. Returned value is not specified. See `set-sender!`.
(set-endpoint! endpoint)
Sets the enpoint description which is included into spans sent by the process.
endpoint
is a map of keyword to any value the sender function
is able to serialize.
The following keywords are recognized:
:service-name
- the name fo the service/application. Is sent
as the "serviceName" field of the endpoint description. If
both :service-name
and :serviceName
keywords are present,
the former overwrites the latter.There is no default value. Should be set before creating the first span.
Sets the enpoint description which is included into spans sent by the process. `endpoint` is a map of keyword to any value the sender function is able to serialize. The following keywords are recognized: - `:service-name` - the name fo the service/application. Is sent as the "serviceName" field of the endpoint description. If both `:service-name` and `:serviceName` keywords are present, the former overwrites the latter. There is no default value. Should be set before creating the first span.
(set-sender! sender)
Sets the function to use for sampling.
sender
is a function taking a list of spans as an argument.
Returns sender
.
The default sender does nothing.
Sets the function to use for sampling. `sender` is a function taking a list of spans as an argument. Returns `sender`. The default sender does nothing.
(set-storage! storage)
Sets the storage used when updating the current span.
storage
is an object implementing zipkin-clj.core/ISpanStorage
.
Returns storage
.
The default storage uses thread-local bindings to store the stack of spans.
Sets the storage used when updating the current span. `storage` is an object implementing `zipkin-clj.core/ISpanStorage`. Returns `storage`. The default storage uses thread-local bindings to store the stack of spans.
(span {span-name :span
:keys [trace-id sample? debug? endpoint parent annotations tags id
timestamp]
:as _opts})
Creates a span.
The options:
:span
- the span name:trace-id
- a string representation of the trace id. The parent's
trace id is used if :parent
is provided. Generated if absent.:id
- a string representation of the span id. Generated if absent.:annotations
- a sequence of annotation strings (the current
timestamp is used).:tags
- a map of the span tags (string/keyword -> scalar).:timestamp
- the span start timestamp in microseconds.:parent
- the parent span.:endpoint
- the endpoint description. Overwrite the value set by
set-endpoint!
.:sample?
- the sampling decision. If true, the span is sampled
(passed to the sender function).:debug?
- if true, the span is sampled no matter what sampling
decision is.Returns the created span.
Creates a span. The options: - `:span` - the span name - `:trace-id` - a string representation of the trace id. The parent's trace id is used if `:parent` is provided. Generated if absent. - `:id` - a string representation of the span id. Generated if absent. - `:annotations` - a sequence of annotation strings (the current timestamp is used). - `:tags` - a map of the span tags (string/keyword -> scalar). - `:timestamp` - the span start timestamp in microseconds. - `:parent` - the parent span. - `:endpoint` - the endpoint description. Overwrite the value set by `set-endpoint!`. - `:sample?` - the sampling decision. If true, the span is sampled (passed to the sender function). - `:debug?` - if true, the span is sampled no matter what sampling decision is. Returns the created span.
(start-span opts)
Creates a span with the current timestamp. Returns the created span.
See span
for the list of options.
Creates a span with the current timestamp. Returns the created span. See `span` for the list of options.
(tag span tags)
Adds tags
to span
.
tags
is a map of keyword/string to a scalar value.
Returns the updated span.
Adds `tags` to `span`. `tags` is a map of keyword/string to a scalar value. Returns the updated span.
(tag! tags)
Adds tags
to the current span. If there is no current span, does
nothing.
Returns the updated span or nil
if none.
See tag
.
Adds `tags` to the current span. If there is no current span, does nothing. Returns the updated span or `nil` if none. See `tag`.
(trace! opts & body)
Executes body
setting the current span to a newly created root span.
Passes the created span (possibly updated during the body execution)
to send-span!
before returning.
Returns the body execution result.
See span
for the list of options.
Note: recur
cannot cross trace!
boundaries.
Executes `body` setting the current span to a newly created root span. Passes the created span (possibly updated during the body execution) to `send-span!` before returning. Returns the body execution result. See `span` for the list of options. Note: `recur` cannot cross `trace!` boundaries.
(trace-context! span & body)
Executes body
setting the current span to span
.
Passes the created span (possibly updated during the body execution)
to send-span!
before returning.
Returns the body execution result.
Note: recur
cannot cross trace-context!
boundaries.
Executes `body` setting the current span to `span`. Passes the created span (possibly updated during the body execution) to `send-span!` before returning. Returns the body execution result. Note: `recur` cannot cross `trace-context!` boundaries.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close