opentelemetry-ext-js icon indicating copy to clipboard operation
opentelemetry-ext-js copied to clipboard

How to debug why kafkajs instrumentation doesn't connect spans on a different service

Open royi-frontegg opened this issue 3 years ago • 3 comments

Hi guys, I'm having some issues with several services that consume kafka messages but creates a new trace instead of connecting it to an existing one. This is not the case for all services, where the instrumentation is working as expected. I'm using 0.27.X libs on all services which makes everything even more confusing. How can I debug the issue?

Thank you

royi-frontegg avatar Jun 05 '22 06:06 royi-frontegg

Hi guys, I'm having some issues with several services that consume kafka messages but creates a new trace instead of connecting it to an existing one. This is not the case for all services, where the instrumentation is working as expected. I'm using 0.27.X libs on all services which makes everything even more confusing. How can I debug the issue?

Thank you

Hi Royi, Are consuming messages from kafka as a batch? if so then the behaviour follows the specification. The issue is that there are many messages (possibly produced by different traces) all "fan-in" into a single operation at the consumer, so there is no one trace to continue. The instrumentation opens a new trace and uses links to the producer context.

blumamir avatar Jun 05 '22 06:06 blumamir

@blumamir no.. I'm using the "eachMessage" api

royi-frontegg avatar Jun 05 '22 14:06 royi-frontegg

I would suggest printing the Kafka headers to make sure they are received correctly on the consumer side. Is the client that produces the messages to Kafka also in nodeJS? Can you share a minimal setup that reproduces the issue?

blumamir avatar Jun 06 '22 10:06 blumamir

Closing the issue. Please reopen if this is still relevant :)

blumamir avatar Aug 18 '22 06:08 blumamir