Particular / NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
https://particular.net/nservicebus/
Other
2.1k stars 647 forks source link

Append an operation name to each OpenTelemetry activity #6720

Open bh3605 opened 1 year ago

bh3605 commented 1 year ago

Describe the feature.

Enabling Open Telemetry support creates telemetry in app insights with no operation name. They bucket in a single operation.

image

Describe the requested feature

Append an operation name to the activity. Could be "EndpointName: send message", "EndpointName: publish event", etc.

Describe alternatives you've considered

Rolling my own implementation

Additional Context

No response

ramonsmits commented 1 year ago

@bh3605 What view is this in application insights?

As you can see in the following sample there is activity name information set in the activities:

We have a set of fixes names we use:

bh3605 commented 1 year ago

It's the performance view image

I do see the activity names in the end-to-end transaction details view image

ramonsmits commented 1 year ago

Thanks @bh3605 for that information. I'm not familiar with that screen. It seems we are providing the operation name so a little research seems needed to understand how that data is presented in this application insights view and what additional properties/tags we need to set.

I'll mark this as an improvement for a future version.

bh3605 commented 1 year ago

Thanks! You can see I was using your sample so reproducing this is straight forward as long as you have an application insights instance to send data too.

I believe what you're going to have to do is at a point a message is sent you need to call StartOperation("", ....) and thereafter you can associate Activity objects with the current operation context.

Helpful link https://learn.microsoft.com/en-us/azure/azure-monitor/app/custom-operations-tracking#applicationinsights-operations-vs-systemdiagnosticsactivity Your distributed tracing sample has the operation name assigned. If you combined that solution with what you have you ought to be gravy. https://docs.particular.net/samples/tracing/

bh3605 commented 1 year ago

@ramonsmits were you able to find anything?