Fix readme formatting and markdown (#2576)
This commit is contained in:
parent
e306aba7ec
commit
bb9eebb73e
|
|
@ -26,7 +26,7 @@ configured. If the external services also have a Baggage span
|
||||||
processor, the keys and values will appear in those child spans as
|
processor, the keys and values will appear in those child spans as
|
||||||
well.
|
well.
|
||||||
|
|
||||||
⚠ Warning ⚠️
|
[!WARNING]
|
||||||
|
|
||||||
Do not put sensitive information in Baggage.
|
Do not put sensitive information in Baggage.
|
||||||
|
|
||||||
|
|
@ -39,25 +39,32 @@ Add the span processor when configuring the tracer provider.
|
||||||
|
|
||||||
To configure the span processor to copy all baggage entries during configuration:
|
To configure the span processor to copy all baggage entries during configuration:
|
||||||
|
|
||||||
```python
|
::
|
||||||
|
|
||||||
from opentelemetry.processor.baggage import BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS
|
from opentelemetry.processor.baggage import BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS
|
||||||
|
|
||||||
tracer_provider = TracerProvider()
|
tracer_provider = TracerProvider()
|
||||||
tracer_provider.add_span_processor(BaggageSpanProcessor(ALLOW_ALL_BAGGAGE_KEYS))
|
tracer_provider.add_span_processor(BaggageSpanProcessor(ALLOW_ALL_BAGGAGE_KEYS))
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, you can provide a custom baggage key predicate to select which baggage keys you want to copy.
|
Alternatively, you can provide a custom baggage key predicate to select which baggage keys you want to copy.
|
||||||
|
|
||||||
For example, to only copy baggage entries that start with `my-key`:
|
For example, to only copy baggage entries that start with `my-key`:
|
||||||
|
|
||||||
```python
|
::
|
||||||
|
|
||||||
starts_with_predicate = lambda baggage_key: baggage_key.startswith("my-key")
|
starts_with_predicate = lambda baggage_key: baggage_key.startswith("my-key")
|
||||||
tracer_provider.add_span_processor(BaggageSpanProcessor(starts_with_predicate))
|
tracer_provider.add_span_processor(BaggageSpanProcessor(starts_with_predicate))
|
||||||
```
|
|
||||||
|
|
||||||
For example, to only copy baggage entries that match the regex `^key.+`:
|
For example, to only copy baggage entries that match the regex `^key.+`:
|
||||||
|
|
||||||
```python
|
::
|
||||||
|
|
||||||
regex_predicate = lambda baggage_key: baggage_key.startswith("^key.+")
|
regex_predicate = lambda baggage_key: baggage_key.startswith("^key.+")
|
||||||
tracer_provider.add_span_processor(BaggageSpanProcessor(regex_predicate))
|
tracer_provider.add_span_processor(BaggageSpanProcessor(regex_predicate))
|
||||||
```
|
|
||||||
|
|
||||||
|
References
|
||||||
|
----------
|
||||||
|
* `OpenTelemetry Project <https://opentelemetry.io/>`_
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue