View Source Membrane.OpenTelemetry (Membrane OpenTelemetry v0.1.0)

Defines macros for operations on (OpenTelemetry)[https://hexdocs.pm/opentelemetry_api] traces, spans and events. Provided macros expand to appropriate calls to (OpenTelemetry)[https://hexdocs.pm/opentelemetry_api] functions or to nothing, depending on config values. Purpose of this module, is to provide simple way of introducing OpenTelemetry into Membrane Elements, Bins and Piplines.

Link to this section Summary

Functions

Adds an event to a span with a specific id.

Adds events to a span with a specific id.

Attaches otel_ctx. See docs for OpenTelemetry.Ctx.attach/1.

Ends a span.

See Membrane.OpenTelemetry.ETSUtils.get_span/1.

Creates new otel_ctx. See docs for OpenTelemetry.Ctx.new/1.

Sets an attribute value in a span with a specific id.

Sets attributes in a span with specific id.

Starts a new span. Returns context of newly created span. First argument is span id. Span id is used to identify span and must be unique within one process.

Link to this section Types

Specs

span_id() :: String.t()

Link to this section Functions

Link to this macro

add_event(id, event, attributes \\ [])

View Source (macro)

Adds an event to a span with a specific id.

Link to this macro

add_events(id, events)

View Source (macro)

Adds events to a span with a specific id.

Attaches otel_ctx. See docs for OpenTelemetry.Ctx.attach/1.

Ends a span.

Specs

get_span(span_id()) :: :opentelemetry.span_ctx() | nil

See Membrane.OpenTelemetry.ETSUtils.get_span/1.

Creates new otel_ctx. See docs for OpenTelemetry.Ctx.new/1.

Link to this macro

set_attribute(id, key, value)

View Source (macro)

Sets an attribute value in a span with a specific id.

Link to this macro

set_attributes(id, attributes)

View Source (macro)

Sets attributes in a span with specific id.

Link to this macro

start_span(id, opts \\ [])

View Source (macro)

Starts a new span. Returns context of newly created span. First argument is span id. Span id is used to identify span and must be unique within one process.

Options:

  • parent_span - a span_ctx of a span, that will be the parent of the created span
  • parent_id - an id of a span, that will be the parent of the created span. Shouldn't be used with parent_span option. Available only for spans, that were created or stored in the same process in which we call this macro.
  • name - name of a span. If not provided, by default span name will be span id