View Source opentelemetry (opentelemetry_api v1.0.3)
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.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()}.
Specs
attribute_key() :: unicode:unicode_binary() | atom().
Specs
attribute_value() :: unicode:unicode_binary() | atom() | number() | boolean() | [unicode:unicode_binary() | atom() | float() | integer() | boolean()] | {unicode:unicode_binary() | atom() | float() | integer() | boolean()}.
Specs
attributes_map() :: #{attribute_key() => attribute_value()} | [attribute()].
Specs
event() :: #{system_time_nano => non_neg_integer(), name := event_name(), attributes := attributes_map()}.
Specs
event_name() :: unicode:unicode_binary() | atom().
Specs
hex_span_id() :: binary().
Specs
hex_trace_id() :: binary().
Specs
instrumentation_library() :: #instrumentation_library{}.
Specs
link() :: #{trace_id := trace_id(), span_id := span_id(), attributes := attributes_map(), tracestate := tracestate()}.
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{}.
Specs
status_code() :: unset | ok | error.
Specs
text_map() :: [{unicode:unicode_binary(), unicode:unicode_binary()}].
Specs
timestamp() :: integer().
Specs
trace_flags() :: non_neg_integer().
Specs
trace_id() :: non_neg_integer().
Specs
tracer() :: {module(), term()}.
Specs
tracestate() :: [{unicode:latin1_chardata(), unicode:latin1_chardata()}].
Link to this section Functions
Specs
convert_timestamp(timestamp(), erlang:time_unit()) -> integer().
erlang:time_unit()
. Meaning the time since Epoch. Epoch is defined to be 00:00:00 UTC, 1970-01-01.
Specs
create_application_tracers([{Application, Description, Vsn}]) -> ok when Application :: atom(), Description :: string(), Vsn :: string().
Specs
event(Name, Attributes) -> event() | undefined when Name :: event_name(), Attributes :: attributes_map().
Specs
event(Timestamp, Name, Attributes) -> event() | undefined when Timestamp :: non_neg_integer(), Name :: event_name(), Attributes :: attributes_map().
Specs
get_application(module()) -> ApplicationTuple when ApplicationTuple :: {Name, Vsn, SchemaUrl} | atom(), Name :: atom(), Vsn :: unicode:unicode_binary() | undefined, SchemaUrl :: uri_string:uri_string() | undefined.
Specs
get_application_tracer(module()) -> tracer().
Specs
get_tracer() -> tracer().
Specs
get_tracer(Name) -> Tracer when Name :: atom() | {Name, Vsn, SchemaUrl}, Vsn :: unicode:chardata() | undefined, SchemaUrl :: uri_string:uri_string() | undefined, Tracer :: opentelemetry:tracer().
Specs
get_tracer(Name, Vsn, SchemaUrl) -> Tracer when Name :: atom(), Vsn :: unicode:chardata() | undefined, SchemaUrl :: uri_string:uri_string() | undefined, Tracer :: opentelemetry:tracer().
Specs
Specs
link(span_ctx() | undefined, attributes_map()) -> link().
Specs
link(TraceId, SpanId, Attributes, TraceState) -> link() | undefined when TraceId :: trace_id(), SpanId :: span_id(), Attributes :: attributes_map(), TraceState :: tracestate().
Specs
links([{TraceId, SpanId, Attributes, TraceState} | span_ctx() | {span_ctx(), Attributes}]) -> [link()] when TraceId :: trace_id(), SpanId :: span_id(), Attributes :: attributes_map(), TraceState :: tracestate().
Specs
set_default_tracer(tracer()) -> boolean().
Specs
set_tracer(atom(), tracer()) -> boolean().
Specs
status(Code) -> status() | undefined when Code :: status_code().
Specs
status(Code, Message) -> status() | undefined when Code :: status_code(), Message :: unicode:unicode_binary().
Specs
timestamp() -> integer().
Specs
timestamp_to_nano(timestamp()) -> integer().
Specs
verify_and_set_term(module() | {module(), term()}, term(), atom()) -> boolean().