NServiceBus icon indicating copy to clipboard operation
NServiceBus copied to clipboard

Append an operation name to each OpenTelemetry activity

Open bh3605 opened this issue 2 years ago • 5 comments

Describe the feature.

Enabling Open Telemetry support creates telemetry in app insights with no operation name. They bucket in a single <Empty> 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

bh3605 avatar Apr 19 '23 19:04 bh3605

@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:

  • https://docs.particular.net/samples/open-telemetry/jaeger/

We have a set of fixes names we use:

  • https://github.com/Particular/NServiceBus/blob/c84561af72649ef1313dd3083a03847a5fe72e2c/src/NServiceBus.Core/OpenTelemetry/Tracing/ActivityNames.cs#L5-L10

ramonsmits avatar Apr 21 '23 10:04 ramonsmits

It's the performance view image

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

bh3605 avatar Apr 21 '23 17:04 bh3605

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.

ramonsmits avatar Apr 22 '23 10:04 ramonsmits

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 avatar Apr 24 '23 14:04 bh3605

@ramonsmits were you able to find anything?

bh3605 avatar May 02 '23 19:05 bh3605