Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Latest commit

 

History

History
273 lines (176 loc) · 10.8 KB

oc_trace.md

File metadata and controls

273 lines (176 loc) · 10.8 KB

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.

Data Types


maybe(T) = T | undefined

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.
parent_span_ctx/1
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


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


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.

parent_span_ctx/1


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) -> SpanCtx

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.