-
Notifications
You must be signed in to change notification settings - Fork 600
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
E2E Test for Broker Tracing #1995
Changes from 21 commits
097daaf
f61cc37
b2a5e32
f6809cd
56bd430
d447731
c35f140
89d1595
0e60281
8e88ecb
1b1e7c6
0cff4ed
2710b02
7c934a6
bd97735
fc7509d
e253e96
a0b6373
16e8104
85cd1b7
99e4368
c6b8a34
fdffd78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,9 @@ import ( | |
"time" | ||
|
||
cloudevents "github.com/cloudevents/sdk-go" | ||
"go.opencensus.io/trace" | ||
"go.uber.org/zap" | ||
"knative.dev/eventing/pkg/broker" | ||
"knative.dev/eventing/pkg/tracing" | ||
"knative.dev/eventing/pkg/utils" | ||
) | ||
|
||
|
@@ -73,8 +73,6 @@ func (h *Handler) serveHTTP(ctx context.Context, event cloudevents.Event, resp * | |
return nil | ||
} | ||
|
||
tracing.AddTraceparentAttributeFromContext(ctx, event) | ||
|
||
reporterArgs := &ReportArgs{ | ||
ns: h.Namespace, | ||
broker: h.BrokerName, | ||
|
@@ -91,6 +89,10 @@ func (h *Handler) serveHTTP(ctx context.Context, event cloudevents.Event, resp * | |
|
||
start := time.Now() | ||
sendingCTX := utils.ContextFrom(tctx, h.ChannelURI) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
// Due to an issue in utils.ContextFrom, we don't retain the original trace context from ctx, so | ||
// bring it in manually. | ||
sendingCTX = trace.NewContext(sendingCTX, trace.FromContext(ctx)) | ||
|
||
rctx, _, err := h.CeClient.Send(sendingCTX, event) | ||
rtctx := cloudevents.HTTPTransportContextFrom(rctx) | ||
// Record the dispatch time. | ||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,26 @@ | ||||||||
// +build e2e | ||||||||
|
||||||||
/* | ||||||||
Copyright 2019 The Knative Authors | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||||
Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||
you may not use this file except in compliance with the License. | ||||||||
You may obtain a copy of the License at | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also missed linefeed here, and in the header of other new files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||||
http://www.apache.org/licenses/LICENSE-2.0 | ||||||||
Unless required by applicable law or agreed to in writing, software | ||||||||
distributed under the License is distributed on an "AS IS" BASIS, | ||||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||
See the License for the specific language governing permissions and | ||||||||
limitations under the License. | ||||||||
*/ | ||||||||
|
||||||||
package conformance | ||||||||
|
||||||||
import ( | ||||||||
"testing" | ||||||||
|
||||||||
"knative.dev/eventing/test/conformance/helpers" | ||||||||
) | ||||||||
|
||||||||
func TestBrokerTracing(t *testing.T) { | ||||||||
helpers.BrokerTracingTestHelper(t, channelTestRunner) | ||||||||
} |
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.
Ctx
instead ofCTX
?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.
From what I understand, Go prefers non-word segments to share capitalization. https://talks.golang.org/2014/names.slide#5 refers to acronyms, "Acronyms should be all capitals, as in ServeHTTP and IDProcessor." CTX isn't an acronym, but it does feel like a similar, non-word segment. So I chose to keep it at the same level of capitalization.