Skip to content

Conversation

@SomilJain0112
Copy link
Contributor

@SomilJain0112 SomilJain0112 commented Oct 19, 2025

Fixes #15990

Proposed Changes

Added OpenTelemetry W3C Trace Context support while maintaining full backward
compatibility with Zipkin B3 format.
Updated all the relevant files.

Release Note

Added support for OpenTelemetry W3C Trace Context (traceparent header) in request logging, while maintaining backward compatibility with Zipkin B3 format.

…backward compatibility with Zipkin B3 format.

Signed-off-by: Somil Jain <[email protected]>
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 19, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@knative-prow
Copy link

knative-prow bot commented Oct 19, 2025

Welcome @SomilJain0112! It looks like this is your first PR to knative/serving 🎉

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 19, 2025
@knative-prow
Copy link

knative-prow bot commented Oct 19, 2025

Hi @SomilJain0112. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@dprotaso
Copy link
Member

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 19, 2025
@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.02%. Comparing base (54868c2) to head (25b7c66).
⚠️ Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16168      +/-   ##
==========================================
- Coverage   80.08%   80.02%   -0.07%     
==========================================
  Files         214      215       +1     
  Lines       16940    13290    -3650     
==========================================
- Hits        13566    10635    -2931     
+ Misses       3015     2295     -720     
- Partials      359      360       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return b3TraceID
}

if b3TraceID := h.Get("X-B3-Traceid"); b3TraceID != "" {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this fallback? I thought Get should look up a canonical version of the key.

https://pkg.go.dev/net/http#Header.Get

// It supports both W3C Trace Context (traceparent) and B3 (X-B3-TraceId) formats.
func ExtractTraceID(h http.Header) string {
if traceparent := h.Get("traceparent"); traceparent != "" {
parts := strings.Split(traceparent, "-")
Copy link
Member

Choose a reason for hiding this comment

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

nit: could use strings.SplitN with N == 3

https://pkg.go.dev/strings#SplitN

@dprotaso
Copy link
Member

We should also update this test

func TestRequestLogs(t *testing.T) {

That was the original reason for the issue

@SomilJain0112
Copy link
Contributor Author

Hii @dprotaso ,
Addressed all of your comments and made corresponding change. Please review.
Thanks!

@dprotaso
Copy link
Member

/hold for release

we'll revist this after we cut 1.20 today

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 28, 2025
@dprotaso
Copy link
Member

@SomilJain0112 thanks for the change

/lgtm
/approve

@dprotaso
Copy link
Member

/hold cancel

@knative-prow knative-prow bot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Nov 18, 2025
@knative-prow
Copy link

knative-prow bot commented Nov 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, SomilJain0112

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 18, 2025
@knative-prow knative-prow bot merged commit 090b6ae into knative:main Nov 18, 2025
95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

change X-B3-Traceid to OTel

2 participants