Module otter_lib_span

This module is the wrapper around the span data structure and exposes functions for span conversion to/from proplist e.g.

Description

This module is the wrapper around the span data structure and exposes functions for span conversion to/from proplist e.g. for external applications that don't want to have the dependency of the record structure.

Function Index

finish/1Finish a span : add duration (current time - timestamp).
from_proplist/1Convert a proplist to span record.
get_duration/1Get the duration of a span.
get_id/1Get the id of a span.
get_ids/1Get ids (trace id and span id) of a span.
get_logs/1Get the list of logs (timestamp-text pairs) of a span.
get_name/1Get the name of a span.
get_parent_id/1Get the parent id of a span.
get_tags/1Get the list of tags (key-value pairs) of a span.
get_timestamp/1Get the start timestamp of a span.
get_trace_id/1Get the trace id of a span.
log/2Adds a log message to a span.
log/3Adds a log message to a span with the specified service information.
start/1Starts a span with the specified name.
start/2Starts a span with the specified name and trace id.
start/3Starts a child span with the specified name, trace id and parent id.
start_with_tags/2Starts a span with the specified name and initial tags.
start_with_tags/3Starts a span with the specified name, initial tags and trace id.
start_with_tags/4Starts a child span with the specified name, trace id and parent id.
tag/3Adds a tag to a span.
tag/4Adds a tag to a span with a given service.
to_proplist/1Convert span record to a proplist.

Function Details

finish/1

finish(Span::span()) -> span()

Finish a span : add duration (current time - timestamp)

from_proplist/1

from_proplist(Proplist::list()) -> span()

Convert a proplist to span record. The proplist is expected to have keys : timestamp, duration, id, trace_id, parent_id, name, tags, logs with the correct values as described in the span record in otter.hrl

get_duration/1

get_duration(Span::span()) -> time_us() | undefined

Get the duration of a span. Returns integer ter the span is finished otherwise undefined

get_id/1

get_id(Span::span()) -> span_id()

Get the id of a span

get_ids/1

get_ids(Span::span()) -> {trace_id(), span_id()}

Get ids (trace id and span id) of a span

get_logs/1

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

Get the list of logs (timestamp-text pairs) of a span

get_name/1

get_name(Span::span()) -> info()

Get the name of a span

get_parent_id/1

get_parent_id(Span::span()) -> span_id() | undefined

Get the parent id of a span

get_tags/1

get_tags(Span::span()) -> [tag()]

Get the list of tags (key-value pairs) of a span

get_timestamp/1

get_timestamp(Span::span()) -> time_us()

Get the start timestamp of a span

get_trace_id/1

get_trace_id(Span::span()) -> span_id()

Get the trace id of a span

log/2

log(Span::span(), Text::info()) -> span()

Adds a log message to a span.

log/3

log(Span::span(), Text::info(), Service::service()) -> span()

Adds a log message to a span with the specified service information.

start/1

start(Name::info()) -> span()

Starts a span with the specified name. Automatically generates a trace id.

start/2

start(Name::info(), TraceId::trace_id()) -> span()

Starts a span with the specified name and trace id

start/3

start(Name::info(), TraceId::trace_id(), ParentId::span_id()) -> span()

Starts a child span with the specified name, trace id and parent id

start_with_tags/2

start_with_tags(Name::info(), InitialTags::[tag()]) -> span()

Starts a span with the specified name and initial tags.

start_with_tags/3

start_with_tags(Name::info(), InitialTags::[tag()], TraceId::trace_id()) -> span()

Starts a span with the specified name, initial tags and trace id

start_with_tags/4

start_with_tags(Name::info(), InitialTags::[tag()], TraceId::trace_id(), ParentId::span_id() | undefined) -> span()

Starts a child span with the specified name, trace id and parent id

tag/3

tag(Span::span(), Key::info(), Value::info()) -> span()

Adds a tag to a span. If the tag already exists, its value will be overwritten.

tag/4

tag(Span::span(), Key::info(), Value::info(), Service::service()) -> span()

Adds a tag to a span with a given service. If the tag already exists, its value will be overwritten.

to_proplist/1

to_proplist(Span::span()) -> list()

Convert span record to a proplist


Generated by EDoc, May 26 2017, 14:22:06.