Skip to content

Commit a4b36a2

Browse files
gugahoaGustavo Aguiar
authored andcommitted
add documentation
1 parent 7fad164 commit a4b36a2

File tree

1 file changed

+44
-2
lines changed
  • processors/opentelemetry_baggage_processor

1 file changed

+44
-2
lines changed

processors/opentelemetry_baggage_processor/README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,48 @@ Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_do
2525
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
2626
be found at [https://hexdocs.pm/opentelemetry_baggage_processor](https://hexdocs.pm/opentelemetry_baggage_processor).
2727

28-
## Configuration
28+
## Usage
2929

30-
TODO: Add configuration instructions
30+
<!-- MDOC -->
31+
32+
`OpentelemetryBaggageProcessor` provides a [Span Processor](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#span-processor)
33+
that takes attributes from the [Baggage](https://hexdocs.pm/opentelemetry_api/otel_baggage.html)
34+
and insert into the Span, once it starts.
35+
36+
A Span Processor is not an application, to use it you must update your
37+
configuration:
38+
39+
```elixir
40+
# config/config.exs
41+
42+
config :opentelemetry, processors,
43+
otel_baggage_processor: %{}},
44+
otel_batch_processor: %{
45+
exporter: {:opentelemetry_exporter, %{}}
46+
}
47+
```
48+
49+
The processor configuration is order-dependent, so `otel_baggage_processor`
50+
configuration must come before the processor used for exporting – in this case,
51+
`otel_batch_processor`.
52+
53+
Now every new span should have what's inside your baggage as attribute.
54+
55+
### Options
56+
57+
* `:prefix` - adds a prefix for all baggage attributes.
58+
* `:filter` - only add attributes if the baggage metadata has the configured key.
59+
The key must be a binary.
60+
61+
### Limitations
62+
63+
Baggage will follow the Context. So any limitation to Context Propagation applies
64+
to Baggage Propagation, and thus to what attributes are going to be added to your
65+
Span.
66+
67+
We can only apply attributes on Span's start, since that's when we can modify
68+
them. There's a [BeforeEnd callback proposal](https://github.com/open-telemetry/opentelemetry-specification/issues/1089)
69+
which would allow us to add the Baggage's attribute on Span's end too, but that
70+
remains as something to be revisited in the future.
71+
72+
<!-- MDOC -->

0 commit comments

Comments
 (0)