opentelemetry (opentelemetry_api v1.0.0-rc.2)

The types defined here, and referencing records in opentelemetry.hrl are used to store trace information while being collected on the Erlang node.

Thus, while the types are based on protos found in the opentelemetry-proto repo: src/opentelemetry/proto/trace/v1/trace.proto, they are not exact translations because further processing is done after the span has finished and can be vendor specific. For example, there is no count of the number of dropped attributes in the span record. And an attribute's value can be a function to only evaluate the value if it is actually used (at the time of exporting). And the stacktrace is a regular Erlang stack trace.

Link to this section Summary

Functions

Convert a native monotonic timestamp to POSIX time of any erlang:time_unit(). Meaning the time since Epoch. Epoch is defined to be 00:00:00 UTC, 1970-01-01.
Generates a 64 bit random integer to use as a span id.
Generates a 128 bit random integer to use as a trace id.
A monotonically increasing time provided by the Erlang runtime system in the native time unit. This value is the most accurate and precise timestamp available from the Erlang runtime and should be used for finding durations or any timestamp that can be converted to a system time before being sent to another system.
Convert a native monotonic timestamp to nanosecond POSIX time. Meaning the time since Epoch. Epoch is defined to be 00:00:00 UTC, 1970-01-01.

Link to this section Types

Specs

attribute() :: {attribute_key(), attribute_value()}.
Link to this type

attribute_key/0

Specs

attribute_key() :: unicode:unicode_binary() | atom().
Link to this type

attribute_value/0

Specs

attribute_value() :: any().
Link to this type

attributes/0

Specs

attributes() :: [attribute()].

Specs

event() :: #event{}.
Link to this type

event_name/0

Specs

event_name() :: unicode:unicode_binary() | atom().

Specs

events() :: [#event{}].

Specs

link() :: #link{}.

Specs

links() :: [#link{}].

Specs

resource() :: #{unicode:unicode_binary() => unicode:unicode_binary()}.

Specs

span() :: term().

Specs

span_ctx() :: #span_ctx{}.

Specs

span_id() :: non_neg_integer().

Specs

span_kind() :: internal | server | client | producer | consumer.

Specs

span_name() :: unicode:unicode_binary() | atom().

Specs

status() :: #status{}.
Link to this type

status_code/0

Specs

status_code() :: unset | ok | error.

Specs

text_map() :: [{unicode:unicode_binary(), unicode:unicode_binary()}].

Specs

timestamp() :: integer().
Link to this type

trace_flags/0

Specs

trace_flags() :: non_neg_integer().

Specs

trace_id() :: non_neg_integer().

Specs

tracer() :: {module(), term()}.
Link to this type

tracestate/0

Specs

tracestate() :: [{unicode:latin1_chardata(), unicode:latin1_chardata()}].

Link to this section Functions

Link to this function

convert_timestamp(Timestamp, Unit)

Specs

convert_timestamp(timestamp(), erlang:time_unit()) -> integer().
Convert a native monotonic timestamp to POSIX time of any erlang:time_unit(). Meaning the time since Epoch. Epoch is defined to be 00:00:00 UTC, 1970-01-01.
Link to this function

event(Name, Attributes)

Specs

event(Name, Attributes) -> event() | undefined
         when Name :: unicode:unicode_binary(), Attributes :: attributes().
Link to this function

event(Timestamp, Name, Attributes)

Specs

event(Timestamp, Name, Attributes) -> event() | undefined
         when
             Timestamp :: non_neg_integer(),
             Name :: unicode:unicode_binary(),
             Attributes :: attributes().
Link to this function

generate_span_id()

Specs

generate_span_id() -> span_id().
Generates a 64 bit random integer to use as a span id.
Link to this function

generate_trace_id()

Specs

generate_trace_id() -> trace_id().
Generates a 128 bit random integer to use as a trace id.
Link to this function

get_text_map_extractors()

Link to this function

get_text_map_injectors()

Specs

get_tracer() -> tracer().
Link to this function

get_tracer(Name)

Specs

get_tracer(atom()) -> tracer().

Specs

link(span_ctx() | undefined) -> link().
Link to this function

link(Span_ctx, Attributes)

Specs

link(span_ctx() | undefined, attributes()) -> link().
Link to this function

link(TraceId, SpanId, Attributes, TraceState)

Specs

link(TraceId, SpanId, Attributes, TraceState) -> link() | undefined
        when
            TraceId :: trace_id(),
            SpanId :: span_id(),
            Attributes :: attributes(),
            TraceState :: tracestate().

Specs

links([{TraceId, SpanId, Attributes, TraceState} | span_ctx() | {span_ctx(), Attributes}]) ->
         links()
         when
             TraceId :: trace_id(),
             SpanId :: span_id(),
             Attributes :: attributes(),
             TraceState :: tracestate().
Link to this function

register_application_tracer(Name)

Specs

register_application_tracer(atom()) -> boolean().
Link to this function

register_tracer(Name, Vsn)

Specs

register_tracer(atom(), string()) -> boolean().
Link to this function

set_default_tracer(Tracer)

Specs

set_default_tracer(tracer()) -> boolean().
Link to this function

set_text_map_extractors(List)

Link to this function

set_text_map_injectors(List)

Link to this function

set_tracer(Name, Tracer)

Specs

set_tracer(atom(), tracer()) -> boolean().
Link to this function

status(Code, Message)

Specs

status(Code, Message) -> status() | undefined
          when Code :: status_code(), Message :: unicode:unicode_binary().

Specs

timestamp() -> integer().
A monotonically increasing time provided by the Erlang runtime system in the native time unit. This value is the most accurate and precise timestamp available from the Erlang runtime and should be used for finding durations or any timestamp that can be converted to a system time before being sent to another system.
Link to this function

timestamp_to_nano(Timestamp)

Specs

timestamp_to_nano(timestamp()) -> integer().
Convert a native monotonic timestamp to nanosecond POSIX time. Meaning the time since Epoch. Epoch is defined to be 00:00:00 UTC, 1970-01-01.
Link to this function

verify_and_set_term(Module, TermKey, Behaviour)

Specs

verify_and_set_term(module() | {module(), term()}, term(), atom()) -> boolean().
Link to this function

verify_and_set_term(AppKey, Module, TermKey, Behaviour)

Link to this function

verify_module_exists(Module)

Specs

verify_module_exists(module() | {module(), term()}) -> boolean().