Modules

oc_reporter oc_reporter_noop oc_reporter_sequential oc_reporter_zipkin oc_sampler oc_sampler_always oc_sampler_never oc_sampler_probability oc_server oc_span oc_span_ctx_binary oc_span_ctx_header oc_stat oc_stat_aggregation oc_stat_aggregation_count oc_stat_aggregation_distribution oc_stat_aggregation_latest oc_stat_aggregation_sum oc_stat_config oc_stat_exporter oc_stat_exporter_prometheus oc_stat_view oc_std_encoder oc_tag_ctx_binary oc_tag_ctx_header oc_tags oc_trace oc_trace_pb oc_transform ocp opencensus opencensus_app opencensus_sup

Module oc_trace

The main module for working with the span in a current context.

Description

This module provides functions for getting the current span context from a ctx variable, creating new spans, and manipulating the span data for the span in the current context.

Function Index

add_link/2 Add a Link to the list of Links in the span.
add_time_event/2 Add an Annotation or MessageEvent to the list of TimeEvents in a span.
add_time_event/3
annotation/2 Create an Annotation.
current_span_ctx/1 Return the current span context in a Ctx or undefined.
finish_span/1 Finish a span, setting the end_time.
from_ctx/1 Return the span context, if it exists, from Ctx.
is_enabled/1 Returns true if trace is enabled.
link/4 Create a Link which can be added to a Span.
message_event/4 Create a MessageEvent.
put_attribute/3 Put an attribute (a key/value pair) in the attribute map of a span.
put_attributes/2 Merge a map of attributes with the current attributes of a span.
set_status/3 Set Status.
start_span/2 Create a new span, detached from any context.
start_span/3
with_child_span/2 Create a child span with parent from the current context Ctx.
with_child_span/3
with_span_ctx/2 Set the current span context in a context to SpanCtx.

Function Details

add_link/2


      add_link(Link::opencensus:link(), SpanCtx::maybe(opencensus:span_ctx())) -> boolean()
      

Add a Link to the list of Links in the span. Returns true if the data was successfully updated.

add_time_event/2


      add_time_event(TimeEvent::opencensus:annotation() | opencensus:message_event(), Span::maybe(opencensus:span_ctx())) -> boolean()
      

Add an Annotation or MessageEvent to the list of TimeEvents in a span. Returns true if the data was successfully updated.

add_time_event/3


      add_time_event(Timestamp::wts:timestamp(), TimeEvent::opencensus:annotation() | opencensus:message_event(), SpanCtx::maybe(opencensus:span_ctx())) -> boolean()
      

annotation/2


      annotation(Description::unicode:unicode_binary(), Attributes::opencensus:attributes()) -> opencensus:annotation()
      

Create an Annotation.

current_span_ctx/1


      current_span_ctx(Ctx::ctx:t()) -> maybe(opencensus:span_ctx())
      

Return the current span context in a Ctx or undefined.

finish_span/1


      finish_span(Span_ctx::maybe(opencensus:span_ctx())) -> boolean()
      

Finish a span, setting the end_time.

from_ctx/1


      from_ctx(Ctx::ctx:t()) -> opencensus:span_ctx()
      

Return the span context, if it exists, from Ctx.

is_enabled/1


      is_enabled(Span_ctx::maybe(opencensus:span_ctx())) -> boolean()
      

Returns true if trace is enabled.

link/4


      link(LinkType::opencensus:link_type(), TraceId::opencensus:trace_id(), SpanId::opencensus:span_id(), Attributes::opencensus:attributes()) -> opencensus:link()
      

Create a Link which can be added to a Span.

message_event/4


      message_event(MessageEventType::opencensus:message_event_type(), Id::integer(), UncompressedSize::integer(), CompressedSize::integer()) -> opencensus:message_event()
      

Create a MessageEvent.

put_attribute/3


      put_attribute(Key::unicode:unicode_binary(), Value::opencensus:attribute_value(), SpanCtx::maybe(opencensus:span_ctx())) -> boolean()
      

Put an attribute (a key/value pair) in the attribute map of a span. If the attribute already exists it is overwritten with the new value. Returns true if the data was successfully updated.

put_attributes/2


      put_attributes(NewAttributes::#{unicode:unicode_binary() => opencensus:attribute_value()}, SpanCtx::maybe(opencensus:span_ctx())) -> boolean()
      

Merge a map of attributes with the current attributes of a span. The new values overwrite the old if any keys are the same. Returns true if the data was successfully updated.

set_status/3


      set_status(Code::integer(), Message::unicode:unicode_binary(), Span_ctx::maybe(opencensus:span_ctx())) -> boolean()
      

Set Status. Returns true if the data was successfully updated.

start_span/2

start_span(Name, SpanCtx) -> any()

Create a new span, detached from any context.

start_span/3


      start_span(Name, SpanCtx, Options) -> SpanCtx
      

with_child_span/2


      with_child_span(Ctx, Name) -> Ctx
      

Create a child span with parent from the current context Ctx. And sets it as the current span context in Ctx.

with_child_span/3


      with_child_span(Ctx, Name, Options) -> Ctx
      

with_span_ctx/2


      with_span_ctx(Ctx, SpanCtx) -> Ctx
      

Set the current span context in a context to SpanCtx. Or to a new span context with name Name that is the child of the span context in Ctx, if it exists.