Module passage_span

Span.

Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>

Description

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

Examples

  %% 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).

Data Types

log()

log() = {passage:log_fields(), erlang:timestamp()}

Timestamped span log fields.

span()

abstract datatype: span()

Span.

Function Index

get_context/1Returns the context of Span.
get_finish_time/1Returns the finish time of Span.
get_logs/1Returns the logs of Span.
get_operation_name/1Returns the operation name of Span.
get_refs/1Returns the references of Span.
get_start_time/1Returns the start time of Span.
get_tags/1Returns the tags of Span.

Function Details

get_context/1

get_context(Span::span()) -> passage_span_context:context()

Returns the context of Span.

get_finish_time/1

get_finish_time(Span::span()) -> {ok, erlang:timestamp()} | error

Returns the finish time of Span.

If the span has not been finished, it will return error.

get_logs/1

get_logs(Span::span()) -> [log()]

Returns the logs of Span.

get_operation_name/1

get_operation_name(Span::span()) -> passage:operation_name()

Returns the operation name of Span.

get_refs/1

get_refs(Span::span()) -> passage:refs()

Returns the references of Span.

get_start_time/1

get_start_time(Span::span()) -> erlang:timestamp()

Returns the start time of Span.

get_tags/1

get_tags(Span::span()) -> passage:tags()

Returns the tags of Span.


Generated by EDoc