Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Traceparent Extension Handling #2873

Merged

Conversation

ian-mi
Copy link
Contributor

@ian-mi ian-mi commented Mar 31, 2020

Fixes #2052

Proposed Changes

  • Remove handling of the traceparent extension. Handling of this extension has moved to the cloudevents SDK.
  • Remove remaining references to B3 and OpenTracing headers. W3C tracecontext headers are used instead.
  • Remove the OpenCensus SetSpanID patch. This is a breaking change and require the patch to be removed downstream when eventing versions are updated.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 31, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 31, 2020
@knative-prow-robot knative-prow-robot added the area/test-and-release Test infrastructure, tests or release label Mar 31, 2020
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/channel/message_receiver.go 76.8% 75.5% -1.3

@ian-mi
Copy link
Contributor Author

ian-mi commented Mar 31, 2020

/assign @n3wscott

Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

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

@ian-mi Why are you removing the traceparent transformer & the traceparent handling in message_receiver? protocol/http.Message, protocol.http/WriteRequest & protocol.http/WriteResponse doesn't handle the tracing, these still needs to be handled by eventing directly.

@ian-mi
Copy link
Contributor Author

ian-mi commented Mar 31, 2020

Message_receiver seems to be the wrong place to inject tracing attributes, we should inject them as close to actually sending the event as possible in order to include any additional spans created during fanout or in the SDK. The intention behind adding trace handling to the cloudevents client was to delegate handling of tracing extensions to the SDK and avoid duplicating code across components and protocols. Is there a reasonable place to put this in the SDK? Ideally we should avoid re-implementing this per-protocol since this code is mostly protocol agnostic (except for the ochttp plugins which must be added for HTTP).

@slinkydeveloper
Copy link
Contributor

slinkydeveloper commented Mar 31, 2020

@ian-mi honestly I think the code we have now in message_receiver still doesn't work 😄 I've opened another PR here: #2862, but i'm going a little blindly on tracing b/c i'm not an expert, i definitely need some help to fix it 😄.

I honestly don't want to implement in sdk-go the tracing at binding level (in the message read/write process), i think that should be done by "who sends/receives the messages". In case of channels, this entity is the code that you see in eventing/pkg/channel. That's why this code should live in eventing.

btw in message_receiver the trace is not injected, it's just "prepared" i think...

@n3wscott
Copy link
Contributor

THANK YOU SO MUCH <3

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 31, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ian-mi, n3wscott

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-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 31, 2020
@n3wscott
Copy link
Contributor

/hold
I did not see the open question

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 31, 2020
@grantr
Copy link
Contributor

grantr commented Mar 31, 2020

I honestly don't want to implement in sdk-go the tracing at binding level (in the message read/write process), i think that should be done by "who sends/receives the messages". In case of channels, this entity is the code that you see in eventing/pkg/channel. That's why this code should live in eventing.

Traceparent is an official CloudEvents extension. It doesn't seem specific to Knative. Why shouldn't the SDK implement it? Is there a technical reason?

@ian-mi ian-mi force-pushed the remove-traceparent-handling branch from c4536e7 to c8b9c10 Compare March 31, 2020 23:43
@knative-prow-robot knative-prow-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm Indicates that a PR is ready to be merged. labels Mar 31, 2020
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 31, 2020
@ian-mi
Copy link
Contributor Author

ian-mi commented Mar 31, 2020

I think that we should look for a way to encapsulate this functionality in the SDK as requiring every implementation to deal with setting tracing extensions will be error prone. For now I've left the traceparent transformer in-place but modified the transformer to use the SDK DistributedTracingExtension type rather than the now-deleted traceparent code so that this PR can be unblocked. Lets sync on how we want to handle tracing in the new bindings code-paths and see where I can help with the implementation.

@ian-mi
Copy link
Contributor Author

ian-mi commented Apr 1, 2020

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 1, 2020
@slinkydeveloper
Copy link
Contributor

Traceparent is an official CloudEvents extension. It doesn't seem specific to Knative. Why shouldn't the SDK implement it? Is there a technical reason?

We have the implementation of extensions for the Event data structure, but nothing with transformers, which are not designed to be "materialized" views of some data, but are direct transformations, while the message is written on the wire. In the SDK we provide some generic transformers (add attribute, add extensions, update extension, ...), but I'm not sure if we want to have these specific transformers... It's something we still didn't discussed

@slinkydeveloper
Copy link
Contributor

DistributedTracingExtension type rather than the now-deleted traceparent code so that this PR can be unblocked. Lets sync on how we want to handle tracing in the new bindings code-paths and see where I can help with the implementation.

Fine, i'll get in touch with you

@slinkydeveloper
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2020
@knative-prow-robot knative-prow-robot merged commit 71a9588 into knative:master Apr 1, 2020
# artificially set the SpanId. See pkg/tracing/traceparent.go for more details.
# Produced with:
# git diff origin/master HEAD -- vendor/go.opencensus.io/trace/trace.go > ./hack/set-span-id.patch
git apply ${REPO_ROOT_DIR}/hack/set-span-id.patch
Copy link
Member

Choose a reason for hiding this comment

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

Awesome! thanks @ian-mi 🎉

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. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. 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.

We patch OpenCensus to add SetSpanID method
8 participants