passage
.
Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>
Process Dictionary version of passage
.
The functions in this module operate on the span which stored in the process dictionary of the calling process.
%% Registers `tracer' Context = passage_span_context_null, Sampler = passage_sampler_all:new(), Reporter = passage_reporter_process:new(self(), span), ok = passage_tracer_registry:register(tracer, Context, Sampler, Reporter), %% Starts a root span ok = passage_pd:start_root_span(example_root, tracer), %% Starts a child span ok = passage_pd:start_span(example_child), %% Finishes spans passage_pd:finish_span(), % child passage_pd:finish_span(), % root %% Receives the finished spans receive {span, FinishedChildSpan} -> ok end, receive {span, FinishedRootSpan} -> ok end.
current_span/0 | Returns the current span stored in the process dictionary of the calling process. |
error_log/1 | Equivalent to error_log(Message, []). |
error_log/2 | Equivalent to error_log(Format, Data, #{}). |
error_log/3 | Equivalent to error_log(Format, Data, Fields, []). |
error_log/4 | Logs error message to the current span. |
finish_span/0 | Equivalent to finish_span([]). |
finish_span/1 | Pops the current span from process dictionary and finishes the span. |
get_baggage_items/0 | Returns the baggage items carried by the current span. |
log/1 | Equivalent to log(Fields, []). |
log/2 | Logs the Fields to the current span. |
set_baggage_items/1 | Sets the baggage items of the current span to Items . |
set_operation_name/1 | Sets the operation name of the current span to OperationName . |
set_tags/1 | Sets the tags of the current span to Tags . |
start_root_span/2 | Equivalent to start_root_span(OperationName, Tracer, []). |
start_root_span/3 | Starts a root span. |
start_span/1 | Equivalent to start_span(OperationName, []). |
start_span/2 | Starts a span. |
with_root_span/3 | Equivalent to with_root_span(OperationName, Tracer, [], Fun). |
with_root_span/4 | Starts a root span enclosing Fun . |
with_span/2 | Equivalent to with_span(OperationName, [], Fun). |
with_span/3 | Starts a span enclosing Fun . |
current_span() -> passage:maybe_span()
Returns the current span stored in the process dictionary of the calling process.
error_log(Message::iodata()) -> ok
Equivalent to error_log(Message, []).
error_log(Format::io:format(), Data::[term()]) -> ok
Equivalent to error_log(Format, Data, #{}).
error_log(Format::io:format(), Data::[term()], Fields::passage:log_fields()) -> ok
Equivalent to error_log(Format, Data, Fields, []).
error_log(Format::io:format(), Data::[term()], Fields::passage:log_fields(), Options::passage:log_options()) -> ok
Logs error message to the current span.
This function logs Fields` and
`#{event => error, message => io_lib:format(Format, Data)}
.
#{error => true}
automatically.
finish_span() -> ok
Equivalent to finish_span([]).
finish_span(Options::passage:finish_span_options()) -> ok
Pops the current span from process dictionary and finishes the span.
The finished span will be sent an external observer via the reporter associated with the tracer of the span.get_baggage_items() -> passage:baggage_items()
Returns the baggage items carried by the current span.
log(Fields::passage:log_fields()) -> ok
Equivalent to log(Fields, []).
log(Fields::passage:log_fields(), Options::passage:log_options()) -> ok
Logs the Fields
to the current span.
set_baggage_items(Items::passage:baggage_items()) -> ok
Sets the baggage items of the current span to Items
.
Note that the existing items which have different keys with Items
are preserved.
set_operation_name(OperationName::passage:operation_name()) -> ok
Sets the operation name of the current span to OperationName
.
set_tags(Tags::passage:tags()) -> ok
Sets the tags of the current span to Tags
.
Tags
are preserved.
start_root_span(OperationName::passage:operation_name(), Tracer::passage:tracer_id()) -> ok
Equivalent to start_root_span(OperationName, Tracer, []).
start_root_span(OperationName::passage:operation_name(), Tracer::passage:tracer_id(), Options::passage:start_root_span_options()) -> ok
Starts a root span.
The started span will be pushed to the process dictionary of the calling process.
If the sampler associated withTracer
does not sample the span,
the value of span will be undefined
.
start_span(OperationName::passage:operation_name()) -> ok
Equivalent to start_span(OperationName, []).
start_span(OperationName::passage:operation_name(), Options::passage:start_span_options()) -> ok
Starts a span.
The started span will be pushed to the process dictionary of the calling process.
If there is no sampled span references, the value of span will beundefined
.
with_root_span(OperationName::passage:operation_name(), Tracer::passage:tracer_id(), Fun) -> Result
Equivalent to with_root_span(OperationName, Tracer, [], Fun).
with_root_span(OperationName::passage:operation_name(), Tracer::passage:tracer_id(), Options::passage:start_span_options(), Fun) -> Result
Starts a root span enclosing Fun
.
with_span(OperationName::passage:operation_name(), Fun) -> Result
Equivalent to with_span(OperationName, [], Fun).
with_span(OperationName::passage:operation_name(), Options::passage:start_span_options(), Fun) -> Result
Starts a span enclosing Fun
.
Generated by EDoc, Oct 23 2017, 04:34:59.