microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
321 stars 138 forks source link

Distributed Tracing not working when using Service Bus topics #1287

Closed dicksongwong closed 4 months ago

dicksongwong commented 4 months ago

I'm building microservices on Azure Functions 4.0 that communicate via Azure Service Bus. The operation id is carried through from one azure function to another when using service bus queues but once the message is published to a topic, the operation id resets for the subscriber and breaks the distributed tracing. Is this the expected behavior? Any workaround?

dicksongwong commented 4 months ago

I think i solved it. When you use the azure output bindings for service bus topics, the Diagnostic-Id in the applicationProperties of the message gets set. We were using the client SDK which requires setting the Diagnostic-Id manually to the context.traceContext.traceParent