Module opentelemetry
The types defined here, and referencing records in opentelemetry.hrl are used to store trace information while being collected on the Erlang node.
Description
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.
Data Types
attribute()
attribute() = {unicode:unicode_binary(), attribute_value()}
attribute_key()
attribute_key() = unicode:unicode_binary()
attribute_value()
attribute_value() = any()
attributes()
attributes() = [attribute()]
event()
event() = #event{system_time_nano = non_neg_integer(), name = unicode:unicode_binary(), attributes = opentelemetry:attributes()}
events()
events() = [#event{system_time_nano = non_neg_integer(), name = unicode:unicode_binary(), attributes = opentelemetry:attributes()}]
http_headers()
http_headers() = [{unicode:unicode_binary(), unicode:unicode_binary()}]
link()
link() = #link{trace_id = opentelemetry:trace_id(), span_id = opentelemetry:span_id(), attributes = opentelemetry:attributes(), tracestate = opentelemetry:tracestate()}
links()
links() = [#link{trace_id = opentelemetry:trace_id(), span_id = opentelemetry:span_id(), attributes = opentelemetry:attributes(), tracestate = opentelemetry:tracestate()}]
meter()
meter() = {module(), term()}
resource()
resource() = #{unicode:unicode_binary() => unicode:unicode_binary()}
span()
span() = term()
span_ctx()
span_ctx() = #span_ctx{trace_id = opentelemetry:trace_id() | undefined, span_id = opentelemetry:span_id() | undefined, trace_flags = integer() | undefined, tracestate = opentelemetry:tracestate() | undefined, is_valid = boolean() | undefined, is_remote = boolean() | undefined, is_recording = boolean() | undefined}
span_id()
span_id() = non_neg_integer()
span_kind()
span_kind() = SPAN_KIND_UNSPECIFIED | INTERNAL | SERVER | CLIENT | PRODUCER | CONSUMER
span_name()
span_name() = unicode:unicode_binary()
stack_trace()
stack_trace() = [erlang:stack_item()]
status()
status() = #status{code = atom() | integer(), message = unicode:unicode_binary()}
timestamp()
timestamp() = integer()
trace_id()
trace_id() = non_neg_integer()
tracer()
tracer() = {module(), term()}
tracestate()
tracestate() = [{unicode:latin1_chardata(), unicode:latin1_chardata()}]
Function Index
Function Details
convert_timestamp/2
convert_timestamp(Timestamp::timestamp(), Unit::erlang:time_unit()) -> integer()
event/2
event(Name, Attributes) -> event() | undefined
Name = unicode:unicode_binary()
Attributes = attributes()
event/3
event(Timestamp, Name, Attributes) -> event() | undefined
Timestamp = non_neg_integer()
Name = unicode:unicode_binary()
Attributes = attributes()
events/1
events(List) -> any()
generate_span_id/0
generate_span_id() -> span_id()
Generates a 64 bit random integer to use as a span id.
generate_trace_id/0
generate_trace_id() -> trace_id()
Generates a 128 bit random integer to use as a trace id.
get_context_manager/0
get_context_manager() -> ot_ctx:context_manager()
get_http_extractor/0
get_http_extractor() -> any()
get_http_injector/0
get_http_injector() -> any()
get_meter/0
get_meter() -> meter()
get_meter/1
get_meter(Name::atom()) -> meter()
get_tracer/0
get_tracer() -> tracer()
get_tracer/1
get_tracer(Name::atom()) -> tracer()
link/4
link(TraceId, SpanId, Attributes, TraceState) -> link() | undefined
TraceId = trace_id()
SpanId = span_id()
Attributes = attributes()
TraceState = tracestate()
links/1
links(List::[{TraceId, SpanId, Attributes, TraceState}]) -> links()
TraceId = trace_id()
SpanId = span_id()
Attributes = attributes()
TraceState = tracestate()
register_application_meter/1
register_application_meter(Name::atom()) -> boolean()
register_application_tracer/1
register_application_tracer(Name::atom()) -> boolean()
register_meter/2
register_meter(Name::atom(), Vsn::string()) -> boolean()
register_tracer/2
register_tracer(Name::atom(), Vsn::string()) -> boolean()
set_default_context_manager/1
set_default_context_manager(ContextManager::ot_ctx:context_manager()) -> boolean()
set_default_meter/1
set_default_meter(Meter::meter()) -> boolean()
set_default_tracer/1
set_default_tracer(Tracer::tracer()) -> boolean()
set_http_extractor/1
set_http_extractor(List) -> any()
set_http_injector/1
set_http_injector(List) -> any()
set_meter/2
set_meter(Name::atom(), Meter::meter()) -> boolean()
set_tracer/2
set_tracer(Name::atom(), Tracer::tracer()) -> boolean()
status/2
status(Code, Message) -> status() | undefined
Code = atom()
Message = unicode:unicode_binary()
timestamp/0
timestamp() -> integer()
timestamp_to_nano/1
timestamp_to_nano(Timestamp::timestamp()) -> integer()