Skip to content

Commit f843d50

Browse files
fix(pubsub): only init batch span if trace enabled (#11193)
Co-authored-by: Alex Hong <9397363+hongalex@users.noreply.github.com>
1 parent 8dedb87 commit f843d50

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pubsub/topic.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,6 @@ func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult {
993993
fcSpan.End()
994994
}
995995

996-
_, batcherSpan = startSpan(ctx, batcherSpanName, "")
997-
998996
bmsg := &bundledMessage{
999997
msg: msg,
1000998
res: r,
@@ -1003,6 +1001,7 @@ func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult {
10031001
}
10041002

10051003
if t.enableTracing {
1004+
_, batcherSpan = startSpan(ctx, batcherSpanName, "")
10061005
bmsg.batcherSpan = batcherSpan
10071006

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

0 commit comments

Comments
 (0)