Repository navigation
opentelemetry-api: improve performance of tracestate parsing - #5746
Merged
herin049 merged 3 commits intoOct 6, 2026
Merged
Conversation
Pull request dashboard statusMerged · refreshed 2026-10-06 00:49 UTC Status above doesn't look right?
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is focused, preserves parsing behavior, and includes appropriate regression and boundary tests.
Review effort: Balanced
Findings: None
What changed in this PR
Improves tracestate parsing performance and limits oversized propagated headers.
Changes:
- Replaces regex splitting with linear comma splitting and whitespace trimming.
- Rejects combined
tracestateheaders exceeding 8192 characters. - Adds whitespace, performance, and size-boundary tests.
| File | Description |
|---|---|
.changelog/5746.fixed |
Documents the parsing fix and size limit. |
opentelemetry-api/src/opentelemetry/trace/span.py |
Optimizes member parsing. |
opentelemetry-api/src/opentelemetry/trace/propagation/tracecontext.py |
Enforces the combined header-length limit. |
opentelemetry-api/tests/trace/test_tracestate.py |
Tests whitespace handling and parsing performance. |
opentelemetry-api/tests/trace/propagation/test_tracecontexthttptextformat.py |
Tests length-limit boundaries. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
aabmass
approved these changes
Oct 5, 2026
emdneto
approved these changes
Oct 5, 2026
herin049
enabled auto-merge
October 6, 2026 00:43
emdneto
pushed a commit
that referenced
this pull request
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Improves the performance of trace state parsing.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Does This PR Require a Contrib Repo Change?
Checklist: