Skip to content

Commit bb9eebb

Browse files
authored
Fix readme formatting and markdown (#2576)
1 parent e306aba commit bb9eebb

File tree

1 file changed

+21
-14
lines changed
  • processor/opentelemetry-processor-baggage

1 file changed

+21
-14
lines changed

Diff for: processor/opentelemetry-processor-baggage/README.rst

+21-14
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ configured. If the external services also have a Baggage span
2626
processor, the keys and values will appear in those child spans as
2727
well.
2828

29-
⚠ Warning ⚠️
29+
[!WARNING]
3030

3131
Do not put sensitive information in Baggage.
3232

@@ -39,25 +39,32 @@ Add the span processor when configuring the tracer provider.
3939

4040
To configure the span processor to copy all baggage entries during configuration:
4141

42-
```python
43-
from opentelemetry.processor.baggage import BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS
42+
::
43+
44+
from opentelemetry.processor.baggage import BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS
45+
46+
tracer_provider = TracerProvider()
47+
tracer_provider.add_span_processor(BaggageSpanProcessor(ALLOW_ALL_BAGGAGE_KEYS))
4448

45-
tracer_provider = TracerProvider()
46-
tracer_provider.add_span_processor(BaggageSpanProcessor(ALLOW_ALL_BAGGAGE_KEYS))
47-
```
4849

4950
Alternatively, you can provide a custom baggage key predicate to select which baggage keys you want to copy.
5051

5152
For example, to only copy baggage entries that start with `my-key`:
5253

53-
```python
54-
starts_with_predicate = lambda baggage_key: baggage_key.startswith("my-key")
55-
tracer_provider.add_span_processor(BaggageSpanProcessor(starts_with_predicate))
56-
```
54+
::
55+
56+
starts_with_predicate = lambda baggage_key: baggage_key.startswith("my-key")
57+
tracer_provider.add_span_processor(BaggageSpanProcessor(starts_with_predicate))
58+
5759

5860
For example, to only copy baggage entries that match the regex `^key.+`:
5961

60-
```python
61-
regex_predicate = lambda baggage_key: baggage_key.startswith("^key.+")
62-
tracer_provider.add_span_processor(BaggageSpanProcessor(regex_predicate))
63-
```
62+
::
63+
64+
regex_predicate = lambda baggage_key: baggage_key.startswith("^key.+")
65+
tracer_provider.add_span_processor(BaggageSpanProcessor(regex_predicate))
66+
67+
68+
References
69+
----------
70+
* `OpenTelemetry Project <https://opentelemetry.io/>`_

0 commit comments

Comments
 (0)