W3CBaggagePropagator drops a list-member over 4096 bytes that W3C Baggage requires it to propagate
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- observability
Research direction
The per-member limit is the _MAX_PAIR_LENGTH constant, checked on both the extract and inject paths of W3CBaggagePropagator; start by reading where that constant is used and how each path drops a member. Confirm the proposed direction with a maintainer before editing, since the spec reading is the open question. Add extract and inject tests at 4100 bytes to tests/propagators/test_w3cbaggagepropagator.py, and check that the 180-member and 8192-byte limits still hold.
Written by the indexing model from the issue text.
Description
Describe your environment
- OS: macOS 26.7.2
- Python version: Python 3.15.2
- SDK version:
mainat66ec883 - API version:
mainat66ec883
What happened?
W3CBaggagePropagator drops any list-member longer than 4096 bytes (_MAX_PAIR_LENGTH), on extract and on inject, even when the whole header is far below 8192 bytes. W3C Baggage has no per-member limit. Its Limits section says a platform MUST propagate all list-members while the baggage-string has 64 members or fewer and is 8192 bytes or smaller, and only past that MAY it drop some.
Steps to Reproduce
from opentelemetry import baggage
from opentelemetry.baggage.propagation import W3CBaggagePropagator
p = W3CBaggagePropagator()
header = "session=" + "a" * 4092 + ",user=alice" # 2 members, 4112 bytes
print("extract:", {k: len(v) for k, v in baggage.get_all(p.extract({"baggage": header})).items()})
carrier = {}
p.inject(carrier, baggage.set_baggage("session", "a" * 4092)) # 1 member, 4100 bytes
print("inject:", carrier)
Expected Result
extract: {'session': 4092, 'user': 5}
inject: {'baggage': 'session=aaaa...'}
Actual Result
$ python bag.py
Baggage entry with key `session` exceeded the maximum number of bytes per list-member with length 4100
Baggage entry with key `session` exceeded the maximum number of bytes per list-member with length 4100
extract: {'user': 5}
inject: {}
Additional context
With _MAX_PAIR_LENGTH = 8192 the same script prints the expected result, and tests/propagators/test_w3cbaggagepropagator.py still passes (34 passed), because its tests derive their sizes from the constant. The 4096 comes from the 2020 Working Draft ("Maximum number of bytes per a single name-value pair: 4096"), which #5163 followed on inject; the current text dropped it, and #5823 kept it. opentelemetry-go has no per-member limit, and its larger members vanish at the first Python hop.
My pick is to remove the per-member check and keep the 180-member and 8192-byte limits. Shall I send that as a pull request with an extract and an inject test at 4100 bytes?
Would you like to implement a fix?
Yes
- Dominant language
- Python
- Stars
- 2.7k
- Forks
- 1.1k
- Avg merge
- 4d 13m
- Merged PRs (30d)
- 38
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from open-telemetry/opentelemetry-python
-
opentelemetry-configuration: OTLP HTTP exporter does not validate TLS files exist at startupPossibly taken @Dotify71 claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
open-telemetry/opentelemetry-python#5928 ·
Maintainers usually reply within 2 days
-
otel.sdk.processor.{span,log}.queue.capacity uses synchronous UpDownCounter recorded once in __init__May be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
open-telemetry/opentelemetry-python#5891 ·
Maintainers usually reply within 2 days
-
Prometheus map_unit incorrectly normalizes percent ratio units such as %/sPossibly taken @knowprasad claimed this 10 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
open-telemetry/opentelemetry-python#5875 · 1 comment · 1 reaction ·
Maintainers usually reply within 2 days
-
OTLP HTTP exporter reports a 3xx response as a successful export, so redirected batches are dropped without any logPossibly taken @d4rshnn claimed this 18 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-python#5865 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
open-telemetry/opentelemetry-python#5700 · 1 comment ·
Maintainers usually reply within 2 days
All issues in open-telemetry/opentelemetry-python
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
docling-project/docling-pipelines#669 ·
Maintainers usually reply within 1 day
-
blocked kind/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
opendatahub-io/agent-eval-harness#329 · 2 comments · 1 reaction ·
-
cc_wrapper crashes with ValueError on Windows when a path is on another drivePossibly taken @TrapsterDK claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
tweag/rules_haskell#2492 ·
Maintainers usually reply within 1 day