skillfed

opentelemetry-processor-baggage

OpenTelemetry Baggage Span Processor

opentelemetry-processor-baggage v0.65b0 4.3M downloads/30d#2,332 on PyPI1,086
Permissive license Apache-2.0 Active released

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-baggage

uv

uv add opentelemetry-processor-baggage

poetry

poetry add opentelemetry-processor-baggage

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

opentelemetry baggage span processorbaggage context propagation tracingspan attribute enrichment baggagedistributed trace context baggagebaggage log processor opentelemetrytrace context propagation filtering
opentelemetrydistributed-tracingobservability

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

opentelemetry-propagator-ot-trace

Provides OpenTelemetry trace context…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-sklearn

Adds distributed tracing instrumentation to…

permissive · top 15,000 on PyPI

pyroscope-otel

Connects OpenTelemetry tracing with Pyroscope…

permissive · top 5,000 on PyPI

opentelemetry-propagator-jaeger

Provides trace context propagation for the…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-threading

Ensures OpenTelemetry context is propagated…

permissive · top 1,000 on PyPI

opentelemetry-propagator-aws-xray

Injects and extracts AWS X-Ray tracing context…

permissive · top 5,000 on PyPI

openinference-instrumentation-mcp

Auto-instruments MCP tool calls to propagate…

permissive · top 15,000 on PyPI

opentelemetry-propagator-b3

Implements the B3 trace context propagation…

permissive · top 5,000 on PyPI

azure-core-tracing-opentelemetry

Integrates Azure SDK clients with OpenTelemetry…

unclear · top 5,000 on PyPI

opentelemetry-instrumentation-django

Adds distributed tracing to Django applications…

permissive · top 1,000 on PyPI