Skip to content

Fix W3CPropagatorcompliance against W3C Trace Context Level 2 - #129414

Merged
tarekgh merged 20 commits into
dotnet:mainfrom
Kielek:w3cpropagator-traceparent-complaiant
Jun 17, 2026
Merged

tarekgh merged 20 commits into
dotnet:mainfrom
Kielek:w3cpropagator-traceparent-complaiant

Conversation

@Kielek

@Kielek Kielek commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #129413

Does not bring strange behavior for key names described under w3c/trace-context#583. Technically it is not fully compliant with the officail tests suite, but also it does not bring any regression in this topic.
I hope it will be addressed under W3C, if not, we can make a follow ups.

If needed, I can add the full python suite here based on Kielek@9f88d19, but I think that existing C# coverage is more than enough.

I have tried to made the commit granular, it might be easier to review it once by one, instead of all at once.

Kielek added 6 commits June 15, 2026 09:05
Validate the full tracestate list instead of returning only the valid prefix. Normalize optional whitespace around list members, discard invalid lists, and apply the Level 2 512-character combined length and 32-entry limits.
Enforce the total 256-character tracestate key limit while keeping at signs valid after the first character. Update W3CPropagator tests to match the corrected trace-context key grammar coverage.
Copilot AI review requested due to automatic review settings June 15, 2026 08:43
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 15, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @dotnet/area-system-diagnostics-tracing
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates W3C Trace Context (traceparent/tracestate) handling to better align with the spec, including stricter tracestate validation and support for future-version traceparent extensions.

Changes:

  • Normalize and validate tracestate according to spec rules (OWS handling, entry count, key/value constraints) and return a canonicalized value.
  • Discard tracestate when traceparent is invalid; trim future-version traceparent extension fields to the core length.
  • Expand and refine xUnit coverage for tracestate/traceparent edge-cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/libraries/System.Diagnostics.DiagnosticSource/tests/W3CPropagatorTests.cs Adds/updates tests for tracestate whitespace, key rules, invalid-member behavior, and traceparent invalid/extension trimming behavior.
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/W3CPropagator.cs Reworks tracestate validation (limits, normalization) and adjusts traceparent extraction to discard tracestate on invalid parent and trim extension fields.

@Kielek
Kielek requested a review from Copilot June 15, 2026 09:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

@Kielek
Kielek requested a review from Copilot June 15, 2026 09:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.

@Kielek
Kielek force-pushed the w3cpropagator-traceparent-complaiant branch from 8a37e24 to 561fea7 Compare June 15, 2026 10:12
Copilot AI review requested due to automatic review settings June 15, 2026 10:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

@Kielek
Kielek requested a review from Copilot June 15, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

@tarekgh

tarekgh commented Jun 15, 2026

Copy link
Copy Markdown
Member

CC @noahfalk

Copilot AI review requested due to automatic review settings June 16, 2026 04:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

@tarekgh tarekgh added this to the 11.0.0 milestone Jun 16, 2026
Copilot AI review requested due to automatic review settings June 17, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Checking nulll is covered by other tests when the traceid is invalid
@tarekgh

tarekgh commented Jun 17, 2026

Copy link
Copy Markdown
Member

/ba-g no real failure, just timeout.

@tarekgh tarekgh left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Kielek, LGTM!

@tarekgh
tarekgh merged commit d72d2fc into dotnet:main Jun 17, 2026
93 of 95 checks passed
@Kielek
Kielek deleted the w3cpropagator-traceparent-complaiant branch June 18, 2026 04:24
@dotnet-milestone-bot dotnet-milestone-bot Bot modified the milestones: 11.0.0, 11.0-preview6 Jun 18, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
Fixes #129413

Does not bring strange behavior for key names described under
w3c/trace-context#583. Technically it is not
fully compliant with the officail tests suite, but also it does not
bring any regression in this topic.
I hope it will be addressed under W3C, if not, we can make a follow ups.

If needed, I can add the full python suite here based on
Kielek@9f88d19,
but I think that existing C# coverage is more than enough.

I have tried to made the commit granular, it might be easier to review
it once by one, instead of all at once.
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Diagnostics.Tracing community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

W3C trace context propagation fails W3C Trace Context Level 2 compliance tests

3 participants