Out of the box, NServiceBus isn’t compatible with Elastic APM.
The good news is, from what I can tell, we have the extensibility points available to make it so.
First NServiceBus needs to publish
System.Diagnostics events. Fortunately one of our Champs @jbogard has created a package called
NServiceBus.Extensions.Diagnostics that does just that.
The package raises events around the different stages of the NServiceBus pipeline. Unfortunately, the exact events are not documented, but looking at the source the one associated with the invoke handlers stage is
The second part is harder. You would need Elastic APM listeners to listen to those specific events and capture them.
To do that you would have to create those listeners using the Elastic APM public API for .NET. You could use the listeners included in the Elastic APM .NET agent as examples to get you going. You would even see the ServiceBus listener in that source.