View Source opentelemetry (opentelemetry_api v1.1.1)
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
-type attribute() :: {attribute_key(), attribute_value()}.
-type attribute_key() :: unicode:unicode_binary() | atom().
-type attribute_value() :: unicode:unicode_binary() | atom() | number() | boolean() | [unicode:unicode_binary() | atom() | float() | integer() | boolean()] | {unicode:unicode_binary() | atom() | float() | integer() | boolean()}.
-type attributes_map() :: #{attribute_key() => attribute_value()} | [attribute()].
-type event() :: #{system_time_native => integer(), name := event_name(), attributes := attributes_map()}.
-type event_name() :: unicode:unicode_binary() | atom().
-type hex_span_id() :: binary().
-type hex_trace_id() :: binary().
-type instrumentation_scope() :: #instrumentation_scope{}.
-type link() :: #{trace_id := trace_id(), span_id := span_id(), attributes := attributes_map(), tracestate := tracestate()}.
-type resource() :: #{unicode:unicode_binary() => unicode:unicode_binary()}.
-type span() :: term().
-type span_ctx() :: #span_ctx{}.
-type span_id() :: non_neg_integer().
-type span_kind() :: internal | server | client | producer | consumer.
-type span_name() :: unicode:unicode_binary() | atom().
-type status() :: #status{}.
-type status_code() :: unset | ok | error.
-type text_map() :: [{unicode:unicode_binary(), unicode:unicode_binary()}].
-type timestamp() :: integer().
-type trace_flags() :: non_neg_integer().
-type trace_id() :: non_neg_integer().
-type tracer() :: {module(), term()}.
-type tracestate() :: [{unicode:latin1_chardata(), unicode:latin1_chardata()}].
Link to this section Functions
-spec 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.
-spec create_application_tracers([{Application, Description, Vsn}]) -> ok
when Application :: atom(), Description :: string(), Vsn :: string().
-spec event(Name, Attributes) -> event() | undefined when Name :: event_name(), Attributes :: attributes_map().
-spec event(Timestamp, Name, Attributes) -> event() | undefined when Timestamp :: integer(), Name :: event_name(), Attributes :: attributes_map().
-spec get_application(module()) -> ApplicationTuple when ApplicationTuple :: {Name, Vsn, SchemaUrl} | atom(), Name :: atom(), Vsn :: unicode:unicode_binary() | undefined, SchemaUrl :: uri_string:uri_string() | undefined.
-spec get_application_scope(module()) -> instrumentation_scope() | undefined.
-spec get_application_tracer(module()) -> tracer().
-spec get_tracer() -> tracer().
-spec get_tracer(Name) -> Tracer when Name :: atom() | {atom(), Vsn, SchemaUrl}, Vsn :: unicode:chardata() | undefined, SchemaUrl :: uri_string:uri_string() | undefined, Tracer :: opentelemetry:tracer().
-spec get_tracer(Name, Vsn, SchemaUrl) -> Tracer when Name :: atom(), Vsn :: unicode:chardata() | undefined, SchemaUrl :: uri_string:uri_string() | undefined, Tracer :: opentelemetry:tracer().
-spec link(span_ctx() | undefined, attributes_map()) -> link() | undefined.
-spec link(TraceId, SpanId, Attributes, TraceState) -> link() | undefined when TraceId :: trace_id(), SpanId :: span_id(), Attributes :: attributes_map(), TraceState :: tracestate().
-spec links([{TraceId, SpanId, Attributes, TraceState} | span_ctx() | {span_ctx(), Attributes}]) -> [link()] when TraceId :: trace_id(), SpanId :: span_id(), Attributes :: attributes_map(), TraceState :: tracestate().
-spec set_default_tracer(tracer()) -> boolean().
-spec set_tracer(atom(), tracer()) -> boolean().
-spec status(Code) -> status() | undefined when Code :: status_code().
-spec status(Code, Message) -> status() | undefined when Code :: status_code(), Message :: unicode:unicode_binary().
-spec timestamp() -> integer().
-spec timestamp_to_nano(timestamp()) -> pos_integer().
-spec verify_and_set_term(module() | {module(), term()}, term(), atom()) -> boolean().