O11y.BaggageProcessor (O11y v0.2.11)
Adds any attributes stored in baggage in the current context to each span that is processed.
Configuration
In your project's config.exs (or runtime.exs or w/e):
config(:opentelemetry, :processors, [{O11y.BaggageProcessor, %{}}])
If there's already a processor configured, you can add this one to the list:
config(:opentelemetry, :processors, [
{O11y.BaggageProcessor, %{}},
otel_batch_processor: %{exporter: {:opentelemetry_exporter, %{}}}
])
Examples
iex> OpenTelemetry.Baggage.set("user_id", user.id)
...> # later in the request
iex> Tracer.with_span "checkout" do
...> # this span will include the user_id attribute automatically
...> end
Summary
Functions
Callback implementation for :otel_span_processor.force_flush/1
.
Callback implementation for :otel_span_processor.on_end/2
.
Callback implementation for :otel_span_processor.on_start/3
.
Types
@type attrs() :: OpenTelemetry.attributes_map()
@type config() :: any()
@type ctx() :: :otel_ctx.t()
@type on_end_result() ::
true | :dropped | {:error, :invalid_span} | {:error, :no_export_buffer}
@type span() :: OpenTelemetry.span()
Functions
Callback implementation for :otel_span_processor.force_flush/1
.
@spec on_end(span(), config()) :: on_end_result()
Callback implementation for :otel_span_processor.on_end/2
.
Callback implementation for :otel_span_processor.on_start/3
.