Skip to content

Commit

Permalink
Remove workaround for incorrect tracing shutdown
Browse files Browse the repository at this point in the history
The issue knative/pkg#2475 has been resolved.
It's not necessary to send multiple events anymore. Each event should be
exported to Zipking because of the new fix for tracer shutdown.
  • Loading branch information
mgencur committed Aug 22, 2022
1 parent c4a276b commit 3385d11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
8 changes: 1 addition & 7 deletions test/e2e_new/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,12 @@ func TracingHeadersUsingOrderedDeliveryWithTraceExported() *feature.Feature {
sourceName,
eventshub.StartSenderToResource(broker.GVR(), brokerName),
eventshub.InputEvent(ev),
// Send at least two events to workaround https://github.com/knative/pkg/issues/2475.
// There's some time needed for exporting the trace to Zipkin. Sending two events with
// some delay gives the exporter time to export the trace for the first event. The sender
// is shutdown immediately after sending the last event so the trace for the last
// event will probably not be exported.
eventshub.SendMultipleEvents(2, 3*time.Second),
))

f.Assert("received event has traceparent header",
OnStore(sinkName).
Match(MatchKind(EventReceived), hasTraceparentHeader).
AtLeast(1),
Exact(1),
)

f.Assert("event trace exported", brokerHasMatchingTraceTree(sourceName, sinkName, brokerName, ev.ID()))
Expand Down
9 changes: 1 addition & 8 deletions test/e2e_new_channel/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"context"
"fmt"
"testing"
"time"

cetest "github.com/cloudevents/sdk-go/v2/test"
"github.com/openzipkin/zipkin-go/model"
Expand Down Expand Up @@ -87,12 +86,6 @@ func eventWithTraceExported() *feature.Feature {
sourceName,
eventshub.StartSenderToResource(channel_impl.GVR(), channelName),
eventshub.InputEvent(ev),
// Send at least two events to workaround https://github.com/knative/pkg/issues/2475.
// There's some time needed for exporting the trace to Zipkin. Sending two events with
// some delay gives the exporter time to export the trace for the first event. The sender
// is shutdown immediately after sending the last event so the trace for the last
// event will probably not be exported.
eventshub.SendMultipleEvents(2, 3*time.Second),
))

f.Assert("event trace exported", channelHasMatchingTraceTree(sourceName, sinkName, channelName, ev.ID()))
Expand Down Expand Up @@ -169,7 +162,7 @@ func channelHasMatchingTraceTree(sourceName, sinkName, channelName, eventID stri
},
},
}
eventshub.StoreFromContext(ctx, sinkName).AssertAtLeast(t, 1,
eventshub.StoreFromContext(ctx, sinkName).AssertExact(t, 1,
MatchKind(EventReceived),
tracing.TraceTreeMatches(sourceName, eventID, expectedTree),
)
Expand Down

0 comments on commit 3385d11

Please sign in to comment.