Skip to content

Commit

Permalink
fix(pubsub): only init batch span if trace enabled (#11193)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Hong <9397363+hongalex@users.noreply.github.com>
  • Loading branch information
duongcongtoai and hongalex authored Dec 3, 2024
1 parent 8dedb87 commit f843d50
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pubsub/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,6 @@ func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult {
fcSpan.End()
}

_, batcherSpan = startSpan(ctx, batcherSpanName, "")

bmsg := &bundledMessage{
msg: msg,
res: r,
Expand All @@ -1003,6 +1001,7 @@ func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult {
}

if t.enableTracing {
_, batcherSpan = startSpan(ctx, batcherSpanName, "")
bmsg.batcherSpan = batcherSpan

// Inject the context from the first publish span rather than from flow control / batching.
Expand Down

0 comments on commit f843d50

Please sign in to comment.