opentelemetry-processor-baggage
OpenTelemetry Baggage Span Processor
What it is and what it does
This package provides span and log processors for OpenTelemetry that automatically attach baggage context data to traces and logs. Baggage is a W3C standard mechanism for propagating key-value pairs across service boundaries in distributed systems. The BaggageSpanProcessor reads baggage entries from the current context when a span starts and adds them as span attributes; the BaggageLogProcessor does the same for log records. Both processors support filtering via custom predicates, so you can control which baggage keys are copied—useful when baggage contains sensitive data that should not appear in all spans.
The package integrates directly with opentelemetry-api and opentelemetry-sdk, requiring only that you add the processor to your tracer or logger provider. Baggage entries propagated to child spans and external services will be visible in those systems if they also have a baggage processor configured. The documentation explicitly warns against storing sensitive information in baggage, since it will appear in all outgoing HTTP headers from your application.
Use it for:
- Attach request IDs or user context from baggage to all child spans in a distributed trace for correlation.
- Filter and copy only specific baggage keys to spans to avoid exposing sensitive data in observability systems.
- Propagate trace metadata (e.g., feature flags, tenant IDs) across service boundaries automatically.
- Enrich log records with baggage context so logs and traces share the same contextual attributes.
- Implement custom baggage filtering logic via predicates to enforce organizational data governance policies.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds baggage context data from OpenTelemetry to spans and logs as attributes, with configurable filtering of which baggage keys to include.
Yes. This is an actively maintained, low-friction component of the OpenTelemetry ecosystem with no known vulnerabilities, permissive licensing, and a clear use case for distributed tracing. Install it if you use OpenTelemetry and need to propagate baggage context to spans or logs; skip it if you do not use baggage or do not need automatic context enrichment.
Install
opentelemetry-processor-baggage on PyPI
pip
pip install opentelemetry-processor-baggageuv
uv add opentelemetry-processor-baggagepoetry
poetry add opentelemetry-processor-baggageInstalling opentelemetry-processor-baggage
Before you install
Low friction install with three stable runtime dependencies (opentelemetry-api, opentelemetry-sdk, wrapt). Package is actively maintained with recent releases and no known vulnerabilities.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install opentelemetry-processor-baggage
from opentelemetry.processor.baggage import BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS
from opentelemetry.sdk.trace import TracerProvider
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(BaggageSpanProcessor(ALLOW_ALL_BAGGAGE_KEYS))
Requires Python 3.10 or later; opentelemetry-api and opentelemetry-sdk must be installed and configured first.
Verify before relying
- Whether baggage key filtering performance scales well with large numbers of predicates or complex regex patterns.
- How baggage propagation behaves when external services do not have a BaggageSpanProcessor configured.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — opentelemetry-api, opentelemetry-sdk, wrapt |
| Maintenance | actively maintained — 29 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,314,347/month — #2,332 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opentelemetry_processor_baggage-0.65b0-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
opentelemetry-propagator-ot-traceProvides OpenTelemetry trace context…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-sklearnAdds distributed tracing instrumentation to…
permissive · top 15,000 on PyPI
pyroscope-otelConnects OpenTelemetry tracing with Pyroscope…
permissive · top 5,000 on PyPI
opentelemetry-propagator-jaegerProvides trace context propagation for the…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-threadingEnsures OpenTelemetry context is propagated…
permissive · top 1,000 on PyPI
opentelemetry-propagator-aws-xrayInjects and extracts AWS X-Ray tracing context…
permissive · top 5,000 on PyPI
openinference-instrumentation-mcpAuto-instruments MCP tool calls to propagate…
permissive · top 15,000 on PyPI
opentelemetry-propagator-b3Implements the B3 trace context propagation…
permissive · top 5,000 on PyPI
azure-core-tracing-opentelemetryIntegrates Azure SDK clients with OpenTelemetry…
unclear · top 5,000 on PyPI
opentelemetry-instrumentation-djangoAdds distributed tracing to Django applications…
permissive · top 1,000 on PyPI