-
Heyo! I'm working on a relatively generic messaging system in Go, and am currently writing/integrating instrumentation for Kafka consumers. I noticed that
What I'm struggling with is writing code that does (at logical level, pseudo-code) following batching: batcher := someBatcher(func(messages []Message, session KafkaSession) {
handleBatch(messages) // I want to create a span around this
for _, message := range messages {
session.MarkProcessed(message)
}
})
messageConsumer := makeConsumer(consumerGroupOptions, batcher); // this retrieves messages one-by-one, passes them to `batcher` In my setup, this means that the start of a span is not a single message, but a larger slice of messages. How would I approach such correlation, if I wanted to make it visible in span attributes? For now, I used this very brutal approach, which is of little use for the span collector services: semconv.MessagingKafkaMessageKey(strings.Join(function.Pipe1(
messages,
array.Map(func(message *sarama.ConsumerMessage) string {
return string(message.Key)
}),
), ","), |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi, Have you looked at the messaging semantic conventions otep? |
Beta Was this translation helpful? Give feedback.
-
Consider looking at https://github.com/dnwe/otelsarama which an instrumentation library for https://github.com/IBM/sarama. |
Beta Was this translation helpful? Give feedback.
Raised: open-telemetry/semantic-conventions#1937
Thanks @dmathieu!