Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>
Span.
Traces in OpenTracing are defined implicitly by their Spans. In particular, a Trace can be thought of as a directed acyclic graph (DAG) of Spans, where the edges between Spans are called References.
Each Span encapsulates the following state:The OpenTracing Data Model
- An operation name
- A start timestamp
- A finish timestamp
- A set of zero or more key:value Span Tags. The keys must be strings. The values may be strings, bools, or numeric types.
- A set of zero or more Span Logs, each of which is itself a key:value map paired with a timestamp. The keys must be strings, though the values may be of any type. Not all OpenTracing implementations must support every value type.
- A SpanContext
- References to zero or more causally-related Spans (via the SpanContext of those related Spans)
%% Registers a tracer
Context = passage_span_context_null,
Sampler = passage_sampler_all:new(),
Reporter = passage_reporter_null:new(),
ok = passage_tracer_registry:register(tracer, Context, Sampler, Reporter),
%% Starts a span
MaybeSpan = passage:start_span(example, [{tracer, tracer}]),
case MaybeSpan of
undefined -> ok;
Span -> example = passage_span:get_operation_name(Span)
end,
%% Finishes a span
passage:finish_span(MaybeSpan).
log() = {passage:log_fields(), erlang:timestamp()}
Timestamped span log fields.
abstract datatype: span()
Span.
| get_context/1 | Returns the context of Span. |
| get_finish_time/1 | Returns the finish time of Span. |
| get_logs/1 | Returns the logs of Span. |
| get_operation_name/1 | Returns the operation name of Span. |
| get_refs/1 | Returns the references of Span. |
| get_start_time/1 | Returns the start time of Span. |
| get_tags/1 | Returns the tags of Span. |
get_context(Span::span()) -> passage_span_context:context()
Returns the context of Span.
get_finish_time(Span::span()) -> {ok, erlang:timestamp()} | error
Returns the finish time of Span.
error.
Returns the logs of Span.
get_operation_name(Span::span()) -> passage:operation_name()
Returns the operation name of Span.
get_refs(Span::span()) -> passage:refs()
Returns the references of Span.
get_start_time(Span::span()) -> erlang:timestamp()
Returns the start time of Span.
get_tags(Span::span()) -> passage:tags()
Returns the tags of Span.
Generated by EDoc, Nov 1 2017, 22:10:30.