opengleametry/span

Types

pub type SpanContext

Values

pub fn current() -> Result(SpanContext, Nil)

Obtain the current span context

pub fn set_attributes(attributes: List(#(String, String))) -> Nil

Wraps opentelemetry_api ?set_attributes macro Needs a current span.

pub fn set_error(error_message: String) -> Nil

Wraps opentelemetry_api ?set_status(error, _) macro Needs a current span.

pub const url_scheme: String
pub fn use_in_this_process(
  current: otel.OtelContext,
  context: SpanContext,
) -> Nil

Create a span based on both the otel and span context from the parent process. Use this method when you do the processing in an actor, and send some result back. NB: the span is not ended, the parent process is expected to do that. By using with or with_links this happens automatically for you.

pub fn with(
  name: String,
  attributes: List(#(String, String)),
  f: fn(SpanContext) -> a,
) -> a

Create a basic span context.

If there is anything that your application needs from this library, it is this function.

pub fn with_links(
  name: String,
  links: List(link.Link),
  attributes: List(#(String, String)),
  f: fn(SpanContext) -> a,
) -> a

Create a span with links obtained within span contexts.

This is explicitly meant in OTEL for usage in asynchronous processing, possibly at some later time (even after a reboot of the application).

In the OTEL UI of your choice, you can track back to the origin, when you investigate an error in this asynchronous handling.

Search Document