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

[testbed] Detect and fix data race at testbed integration test #30549

Merged
merged 6 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Get td.SpanCount() before batchTraces move the spans
Signed-off-by: James Ryans <[email protected]>
  • Loading branch information
james-ryans committed Jan 14, 2024
commit 08e3302f3899cf5af29962a96790c25c6d5f8920
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ func (ocr *Receiver) processReceivedMsg(
func (ocr *Receiver) sendToNextConsumer(longLivedRPCCtx context.Context, td ptrace.Traces) error {
ctx := ocr.obsrecv.StartTracesOp(longLivedRPCCtx)

numReceivedSpans := td.SpanCount()
err := ocr.nextConsumer.ConsumeTraces(ctx, td)
ocr.obsrecv.EndTracesOp(ctx, receiverDataFormat, td.SpanCount(), err)
ocr.obsrecv.EndTracesOp(ctx, receiverDataFormat, numReceivedSpans, err)

return err
}
3 changes: 2 additions & 1 deletion receiver/zipkinreceiver/trace_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,14 @@ func (zr *zipkinReceiver) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

numReceivedSpans := td.SpanCount()
consumerErr := zr.nextConsumer.ConsumeTraces(ctx, td)

receiverTagValue := zipkinV2TagValue
if asZipkinv1 {
receiverTagValue = zipkinV1TagValue
}
obsrecv.EndTracesOp(ctx, receiverTagValue, td.SpanCount(), consumerErr)
obsrecv.EndTracesOp(ctx, receiverTagValue, numReceivedSpans, consumerErr)
if consumerErr == nil {
// Send back the response "Accepted" as
// required at https://zipkin.io/zipkin-api/#/default/post_spans
Expand Down