Skip to content

Commit 2a70b5c

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

File tree

1 file changed

+40
-2
lines changed
  • processors/opentelemetry_baggage_processor

1 file changed

+40
-2
lines changed

processors/opentelemetry_baggage_processor/README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,44 @@ 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,
43+
processors: [{:otel_baggage_processor, %{}}]
44+
```
45+
46+
If you already have another processor defined, like `:otel_batch_processor`, add
47+
the tuple and don't override the whole configuration.
48+
49+
Now every new span should have what's inside your baggage as attribute.
50+
51+
### Options
52+
53+
* `:prefix` - adds a prefix for all baggage attributes.
54+
* `:filter` - only add attributes if the baggage metadata has the configured key.
55+
The key must be a binary.
56+
57+
### Limitations
58+
59+
Baggage will follow the Context. So any limitation to Context Propagation applies
60+
to Baggage Propagation, and thus to what attributes are going to be added to your
61+
Span.
62+
63+
We can only apply attributes on Span's start, since that's when we can modify
64+
them. There's a [BeforeEnd callback proposal](https://github.com/open-telemetry/opentelemetry-specification/issues/1089)
65+
which would allow us to add the Baggage's attribute on Span's end too, but that
66+
remains as something to be revisited in the future.
67+
68+
<!-- MDOC -->

0 commit comments

Comments
 (0)