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

Latest commit

 

History

History
390 lines (252 loc) · 13.4 KB

ocp.md

File metadata and controls

390 lines (252 loc) · 13.4 KB

Module ocp

ocp uses the pdict instead of a ctx variable for tracking context.

Description

The functions fetch the current span context from the pdict and passes it through to the oc_trace function of the same name.

Data Types


maybe(T) = T | undefined

Function Index

add_link/1 Add a Link to the list of Links in the current span.
add_time_event/1 Add an Annotation or MessageEvent to the list of TimeEvents in the current span.
add_time_event/2
current_span_ctx/0
current_tags/0
finish_span/0 Finishes the span in the current pdict context.
put_attribute/2 Put an attribute (a key/value pair) in the attribute map of a span.
put_attributes/1 Merge a map of attributes with the attributes of current span.
record/2 Records a measurement with tags from the pdict context.
set_status/2 Set Status of current span.
spawn/1 Starts a new process using erlang:spawn/1 with current_span_ctx and current_tags from the calling process.
spawn/2 Starts a new process using erlang:spawn/2 with current_span_ctx and current_tags from the calling process.
spawn/3 Starts a new process using erlang:spawn/3 with current_span_ctx and current_tags from the calling process.
spawn/4 Starts a new process using erlang:spawn/4 with current_span_ctx and current_tags from the calling process.
spawn_link/1 Starts a new process using erlang:spawn_link/1 with current_span_ctx and current_tags from the calling process.
spawn_link/2 Starts a new process using erlang:spawn_link/2 with current_span_ctx and current_tags from the calling process.
spawn_link/3 Starts a new process using erlang:spawn_link/3 with current_span_ctx and current_tags from the calling process.
spawn_link/4 Starts a new process using erlang:spawn_link/4 with current_span_ctx and current_tags from the calling process.
spawn_monitor/1 Starts a new process using erlang:spawn_monitor/1 with current_span_ctx and current_tags from the calling process.
spawn_monitor/3 Starts a new process using erlang:spawn_monitor/3 with current_span_ctx and current_tags from the calling process.
spawn_opt/2 Starts a new process using erlang:spawn_opt/2 with current_span_ctx and current_tags from the calling process.
spawn_opt/3 Starts a new process using erlang:spawn_opt/3 with current_span_ctx and current_tags from the calling process.
spawn_opt/4 Starts a new process using erlang:spawn_opt/4 with current_span_ctx and current_tags from the calling process.
spawn_opt/5 Starts a new process using erlang:spawn_opt/5 with current_span_ctx and current_tags from the calling process.
update_tags/1 Merges the tags in the current context with a map of tags.
with_child_span/1 Starts a new span as a child of the current span and replaces it.
with_child_span/2 Starts a new span with attributes as a child of the current span and replaces it.
with_child_span/3 Starts a new span as a child of the current span and uses it as the current span while running the function Fun, finishing the span and resetting the current span context after the function finishes.
with_span_ctx/1 Replaces the span in the current context.
with_tags/1 Replaces the tags in the current context.

Function Details

add_link/1


add_link(Link::opencensus:link()) -> boolean()

Add a Link to the list of Links in the current span.

add_time_event/1


add_time_event(TimeEvent::opencensus:annotation() | opencensus:message_event()) -> boolean()

Add an Annotation or MessageEvent to the list of TimeEvents in the current span.

add_time_event/2


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

current_span_ctx/0


current_span_ctx() -> maybe(opencensus:span_ctx())

current_tags/0


current_tags() -> opencensus:tags()

finish_span/0


finish_span() -> boolean()

Finishes the span in the current pdict context.

put_attribute/2


put_attribute(Key::unicode:unicode_binary(), Value::opencensus:attribute_value()) -> boolean() | {error, invalid_attribute}

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.

put_attributes/1


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

Merge a map of attributes with the attributes of current span. The new values overwrite the old if any keys are the same.

record/2


record(MeasureName::oc_stat_measure:name(), Value::number()) -> ok

Records a measurement with tags from the pdict context.

Raises {unknown_measure, MeasureName} if measure doesn't exist.

set_status/2


set_status(Code::integer(), Message::unicode:unicode_binary()) -> boolean()

Set Status of current span.

spawn/1

spawn(Fun) -> any()

Starts a new process using erlang:spawn/1 with current_span_ctx and current_tags from the calling process.

spawn/2

spawn(Node, Fun) -> any()

Starts a new process using erlang:spawn/2 with current_span_ctx and current_tags from the calling process.

spawn/3

spawn(M, F, A) -> any()

Starts a new process using erlang:spawn/3 with current_span_ctx and current_tags from the calling process.

spawn/4

spawn(Node, M, F, A) -> any()

Starts a new process using erlang:spawn/4 with current_span_ctx and current_tags from the calling process.

spawn_link/1

spawn_link(Fun) -> any()

Starts a new process using erlang:spawn_link/1 with current_span_ctx and current_tags from the calling process.

spawn_link/2

spawn_link(Node, Fun) -> any()

Starts a new process using erlang:spawn_link/2 with current_span_ctx and current_tags from the calling process.

spawn_link/3

spawn_link(M, F, A) -> any()

Starts a new process using erlang:spawn_link/3 with current_span_ctx and current_tags from the calling process.

spawn_link/4

spawn_link(Node, M, F, A) -> any()

Starts a new process using erlang:spawn_link/4 with current_span_ctx and current_tags from the calling process.

spawn_monitor/1

spawn_monitor(Fun) -> any()

Starts a new process using erlang:spawn_monitor/1 with current_span_ctx and current_tags from the calling process.

spawn_monitor/3

spawn_monitor(M, F, A) -> any()

Starts a new process using erlang:spawn_monitor/3 with current_span_ctx and current_tags from the calling process.

spawn_opt/2

spawn_opt(Fun, Opt) -> any()

Starts a new process using erlang:spawn_opt/2 with current_span_ctx and current_tags from the calling process.

spawn_opt/3

spawn_opt(Node, Fun, Opt) -> any()

Starts a new process using erlang:spawn_opt/3 with current_span_ctx and current_tags from the calling process.

spawn_opt/4

spawn_opt(M, F, A, Opt) -> any()

Starts a new process using erlang:spawn_opt/4 with current_span_ctx and current_tags from the calling process.

spawn_opt/5

spawn_opt(Node, M, F, A, Opt) -> any()

Starts a new process using erlang:spawn_opt/5 with current_span_ctx and current_tags from the calling process.

update_tags/1


update_tags(Map::maps:map()) -> opencensus:tags()

Merges the tags in the current context with a map of tags.

with_child_span/1


Starts a new span as a child of the current span and replaces it.

with_child_span/2


Starts a new span with attributes as a child of the current span and replaces it.

with_child_span/3


with_child_span(Name::unicode:unicode_binary(), Attributes::opencensus:attributes(), Fun::function()) -> maybe(opencensus:span_ctx())

Starts a new span as a child of the current span and uses it as the current span while running the function Fun, finishing the span and resetting the current span context after the function finishes.

with_span_ctx/1


with_span_ctx(SpanCtx::opencensus:span_ctx()) -> maybe(opencensus:span_ctx())

Replaces the span in the current context.

with_tags/1


Replaces the tags in the current context.