Skip to content

Commit 57b9c6f

Browse files
0x6368656174atlasppuchkov
authored andcommitted
fix: fix MessageQueue._publish Otel span ending
Signed-off-by: Pavel Puchkov <ppuchkov@atlassian.com>
1 parent 91ebe73 commit 57b9c6f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/publisher/message-queues.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,15 @@ export abstract class MessageQueue extends EventEmitter {
173173
throw e;
174174
} finally {
175175
messages.forEach(m => {
176-
// We're finished with both the RPC and the whole publish operation,
177-
// so close out all of the related spans.
178-
rpcSpan?.end();
179176
tracing.PubsubEvents.publishEnd(m);
180-
m.parentSpan?.end();
181177
});
178+
179+
// We're finished with both the RPC and the whole publish operation,
180+
// so close out all of the related spans.
181+
new Set(messages.map(m => m.parentSpan)).forEach(parentSpan => {
182+
parentSpan?.end();
183+
});
184+
rpcSpan?.end();
182185
}
183186
}
184187
}

0 commit comments

Comments
 (0)