Activity format in MassTransit 6.0.2 and beyond, distributed tracing with Application Insights

43 views
Skip to first unread message

Karol Horodelski

unread,
Feb 22, 2020, 7:43:01 AM2/22/20
to masstransit-discuss
Hi,
I've been setting up two web apps (.net core 3.1) of which one was running MassTransit (6.0.2). Both were logging to Application Insights, but for some reason the http calls (completely unrelated to MassTransit) from one to another were not being correlated in App Insights. Disabling MassTransit in the 'server' app fixed the correlation. Version 6.1.0 had the same behavior.


MassTransit in its LogContext class overrides the global Activity format to use Request-Id instead of the new default W3C Trace-Context (as explained here: https://docs.microsoft.com/en-us/azure/azure-monitor/app/correlation#correlation-headers ). The client web app making http calls was using the newer default format. Once I switched format to legacy in the client app, correlation in Application Insights worked as expected.

I would have expected the Activity to run on AspNetCore/App Insights defaults since I didn't override it myself. Also, there does not seem to be a choice here unless I change the Activity properties after the bus starts. I'm guessing that this is how MassTransit used to work before the new default (I am new to MassTransit), but right now it is affecting a global application setting that can cause unexpected behavior in unrelated functionality (as in my case).

Would you consider making this opt-in, or is the legacy format straight-up required for MassTransit to work?

Thank you for your time.

Chris Patterson

unread,
Feb 23, 2020, 7:51:11 AM2/23/20
to masstrans...@googlegroups.com
It should be a configuration option, I agree. The HTTP setup (and W3C) works with RabbitMQ, but for Azure Service Bus - that is still stuck using the legacy IDs. Until that is updated, that's where MassTransit defaults.

I agree that it should be configurable, when configuring the log context to specify the log format.


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/6ccc2cf6-f3cc-4b3d-98e2-2562d0b9c318%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages