Skip to content

Commit 29e25b3

Browse files
committed
upd
1 parent 7be2a61 commit 29e25b3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

boundaries/metadata/internal/infrastructure/mq/subscribe.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,17 @@ func (e *Event) SubscribeLinkCreated(
4747

4848
go func() {
4949
for msg := range messages {
50-
// 1) Extract consumer context created by otelsarama
50+
// 1) Get message context (contains consumer span created by otelsarama)
51+
// otelsarama automatically extracts traceparent from Kafka RecordHeaders
52+
// and creates a consumer span linked to the producer span
5153
msgCtx := msg.Context()
5254
if msgCtx == nil {
5355
msgCtx = ctx
5456
}
5557

56-
// 2) Extract producer span context from Kafka metadata and attach to message context
58+
// 2) Extract trace context from message metadata
59+
// This ensures proper parent-child relationship between producer and consumer spans
60+
// shortwatermill.ExtractTrace handles the complete trace propagation
5761
msgCtx = shortwatermill.ExtractTrace(msgCtx, msg)
5862
msg.SetContext(msgCtx)
5963

0 commit comments

Comments
 (0)