-
Notifications
You must be signed in to change notification settings - Fork 74
Accept both B3 and TraceContext Tracing #1335
Accept both B3 and TraceContext Tracing #1335
Conversation
…ontext style. Egressing only TraceContext style is done for backwards compatibility with the existing system, which sends TraceContext style. We could output both styles, but it was determined that the additional overhead of ~100 bytes on every outgoing message was not worth it.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Harwayne 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 |
@nachocano should we hold this until after #1296 is in? |
/lgtm |
Yes. It'd be great if we can hold it.
We need the other one in asap. And this will have a bunch of conflicts.
Hopefully we will get it in later today or tomorrow.
There is a new problem with UTs with the newer eventing reconcilers. Cong
is helping investigate
…On Tue, Jun 23, 2020 at 5:50 PM Eric Lemar ***@***.***> wrote:
/lgtm
/hold
Holding for nacho's reply
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1335 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABD65DE3INBEPRFT7MQTRTDRYFET3ANCNFSM4OGFMD2A>
.
|
I take this back. I was changing all e2e to start using cev2 and removing the good_client, but I rollbacked those changes as it can be done in a follow up, after mine and yours get in... |
/hold cancel |
/lgtm |
/hold I clearly did something wrong:
|
Is there a possibility the handlers were already wrapped (or internally registered traces) in the new wrapping calls you added? |
@@ -68,7 +67,7 @@ func NewHTTPClient(ctx context.Context, maxConnsPerHost MaxConnsPerHost) *nethtt | |||
MaxConnsPerHost: int(maxConnsPerHost), | |||
IdleConnTimeout: 30 * time.Second, | |||
}, | |||
Propagation: &tracecontext.HTTPFormat{}, | |||
Propagation: tracecontextb3.TraceContextEgress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary as the client is already configured to use tracecontext.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, this isn't really needed as this function returns an http.Client
, which is egress only. However, I would like to change it to be consistent with all other places in the repo. The actual difference in runtime will be miniscule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use the regular tracecontext format everywhere we don't need special behavior? That would maintain consistency and I feel that it is somewhat confusing to configure the client with a format that has special unneeded ingress behavior. I reviewed the tracecontextb3 PR before the formats were split but it should actually be unnecessary to have separate egress and ingress formats since the format is only every used with a handler (ingress) or a client transport (egress).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use the regular tracecontext format everywhere we don't need special behavior? That would maintain consistency
Consistency with what? For the rest of this comment I will assume it is consistency within this repo or knative more generally. As opposed to consistency with the wider world of software using OpenCensus.
I disagree that it is simpler or more consistent to use &tracecontext.HTTPFormat{}
for ingress and tracecontextb3.TraceContextEgress
for egress, rather than always using tracecontextb3.TraceContextEgress
for both. There is some runtime overhead, but it is going to be effectively imperceptible (one stack frame and an iteration of a size one slice per HTTP request, AFAICT).
If we always use the same format, then developers don't have to understand when to use each. They just always use tracecontextb3.TraceContextEgress
, which gives the desired behavior in both circumstances.
@@ -42,7 +43,7 @@ type Config struct { | |||
// Main should be called by the process' main function. It will run the knockdown test. The return | |||
// value MUST be used in os.Exit(). | |||
func Main(config Config, kdr Receiver) int { | |||
client, err := cloudevents.NewDefaultClient() | |||
client, err := kncloudevents.NewDefaultClient() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that we should change the test image as we expect to always be given tracecontext headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reasoning is consistency. There is little downside to accepting both, so why not do it? The only real reason we wouldn't is to verify that the incoming headers truly are TraceContext, rather than B3.
I also expect sooner or later someone will copy-paste this code and want the 'best practice' to be what they copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right my concern is detecting a regression where B3 is used instead of tracecontext. I also think that for normal event consumers accepting only tracecontext is good practice as that is what they should expect the broker to give them. On the other hand broker components should always use the clients package providers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched back with a comment explaining this is for tests only.
@@ -45,7 +45,7 @@ var ( | |||
MaxConnsPerHost: 500, | |||
IdleConnTimeout: 30 * time.Second, | |||
}, | |||
Propagation: &tracecontext.HTTPFormat{}, | |||
Propagation: tracecontextb3.TraceContextEgress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also should be unnecessary as the client is already configured to use trace context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same argument as above? Namely that because this is an http.Client
, it is inherently an egress only thing, and therefore doesn't need this new format?
/unhold |
/retest |
2 similar comments
/retest |
/retest |
/lgtm |
/retest |
2 similar comments
/retest |
/retest |
The following jobs failed:
Job pull-google-knative-gcp-wi-tests expended all 3 retries without success. |
/retest |
Helps with #1147.
Proposed Changes
tracecontextb3.TraceContextEgress
in all of our client code for consistency with our server code (which should have been updated when upstream Accept both B3 and TraceContext style tracing knative/eventing#3388 was vendored in).Release Note