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_span(example_root, [{tracer, 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.
with_span_option() = {error_if_exception, boolean()} | passage:start_span_option()
error_if_exception: If true, the exception which raised while executing the function will be logged and the span will be tagged as error. The default value is true.with_span_options() = [with_span_option()]
Options for with_span/3
| current_span/0 | Returns the current span stored in the process dictionary of the calling process. |
| 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. |
| set_tracer/1 | Sets the tracer of the current span to Tracer. |
| start_span/1 | Equivalent to start_span(OperationName, []). |
| start_span/2 | Starts a span. |
| with_parent_span/2 | Saves ParentSpan in the current process dictionary then executes 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.
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) -> ok
Equivalent to log(Fields, []).
log(Fields, Options::passage:log_options()) -> ok
Logs the Fields to the current span.
set_baggage_items(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) -> ok
Sets the tags of the current span to Tags.
Tags are preserved.
set_tracer(Tracer::passage:tracer_id()) -> ok
Sets the tracer of the current span to Tracer.
At the finish of the span, the reporter of Tracer will be used to report it.
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_parent_span(ParentSpan, Fun) -> Result
Saves ParentSpan in the current process dictionary then executes Fun.
ParentSpan will be popped from the process dictionary.
with_span(OperationName::passage:operation_name(), Fun) -> Result
Equivalent to with_span(OperationName, [], Fun).
with_span(OperationName::passage:operation_name(), Options::with_span_options(), Fun) -> Result
Starts a span enclosing Fun.
Generated by EDoc, Nov 1 2017, 22:10:30.