New NServiceBus NewRelic Roslyn Analyzer for monitoring message handlers

Hey Everyone,

I have just published a new roslyn analyzer that can help remove the pain of attempting to monitor your NServiceBus Endpoints related message handlers in newrelic.


https://www.nuget.org/packages/NServiceBus.NewRelic.Analyzer/

This was created because the .NET NewRelic agent automatically instruments certain application frameworks ( as indicated https://docs.newrelic.com/docs/agents/net-agent/getting-started/net-agent-compatibility-requirements-net-framework/#messaging ). NServiceBus was one of these. Unfortunately, when NServiceBus rewrote their whole message handling pipeline to ensure async/await was a first class citizen, this broken the automatic instrumentation that the newrelic engineers wrote. This means, when upgrading from NServiceBus to V6+ NewRelic will no longer create transactions for you and you will be flying blind.

This Analyzer provides a “reasonable” workaround by automatically giving you a compiler error ( and appropriate codefix ) when you are missing a newrelic [Transaction] attribute around any nservicebus related message handler ( sagas and timeouts included ). Until the newrelic fixes/implements this feature ( NewRelic Feature Request: https://discuss.newrelic.com/t/feature-idea-add-support-for-nservicebus-version-6/44006 ) this is the best alternative available.

If anyone is currently using newrelic to monitor their nservicebus endpoints i would love to hear some feedback on this new analyzer along with how others have been dealing with this issue.

Thanks,
Enjoy

1 Like