ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

Disable correlation for Azure Function

Open Jeej opened this issue 5 years ago • 4 comments

Describe your environment. Describe any aspect of your environment relevant to the question:

  • SDK version:
    • Microsoft.ApplicationInsights 2.13.1
    • Microsoft.Azure.WebJobs.Extensions.ServiceBus 4.1.1
    • Microsoft.Azure.WebJobs.Extensions.Http 3.0.0
    • Microsoft.NET.Sdk.Functions 3.0.6
  • .NET runtime version (.NET or .NET Core, TargetFramework in the .csproj file): netcoreapp3.1
  • Hosting Info (IIS/Azure WebApps/etc): Azure, App Service Environment
  • Platform and OS version: Windows

What are you trying to achieve? We have multiple systems, lets call them system Z and system Y. In system X are 10.000+ items that requires an transformation, update and needed to be added to system Y. To facilitate this, there are two Azure Functions. The first function is a HTTP trigger that puts N number of messages on a Azure Service Bus Queue. The second function is a ServiceBusTrigger that retrieves the message from the queue and transforms, update and saves the item to system Y. (If this is the most sensible way of approach is not the issue now.)

When we go into Application Insights in the Azure Portal to check exceptions everything is connected to each other because of the first HTTP trigger. So for instance, if I queue 10 items and item 2 fails in the transform part the "End-to-end transaction details" shows my exception, but also the "sibling" messages because everything is a child of the HTTP trigger.

For 10 items it is not that big of a problem, but I have many items and I queue many at once. So my interface looks like this: image

What did you expect to see? There should be a way to disable the correlation between different steps. The idea of business transactions and how they are usually behaving, but in this case I want to have more control. For instance it would be nice if I can disable the "connection" between the processing of the service bus message and the initial HTTP trigger.

Additional context. To solve the issue we have tried to set the parent id in the telemetry context to an empty string (didn't work) and custom telemetry processor that skips service bus calls (no service bus dependencies but the connection is made). Also tried to change the operation id, but that resulted that the tree was broken but everything was still there...

Perhaps there is something simple to achieve what we want, but we couldn't find it....

Thank you in advance!

Jeej avatar May 18 '20 13:05 Jeej

I have a similar need. In my case, i send scheduled messages to myself in a loop. During each iteration i also send trigger messages to other services. The current implementation causes all of my function executions, that originate from such a scheduled message loop, to be part of the same operation.

What i need is a means to not pass the operation id when sending the scheduled message to myself.

wis3guy avatar Apr 12 '21 16:04 wis3guy

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Feb 07 '22 00:02 github-actions[bot]

Unfortunately, I am currently not in the position to check / test if this is still the case / issue. Still, I would like to be able to have some influence on the data that is collected.

Jeej avatar Feb 07 '22 13:02 Jeej

Confirmed that yes, it is still the case.

johndoe312 avatar Aug 08 '22 11:08 johndoe312

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

github-actions[bot] avatar Jun 05 '23 00:06 github-actions[bot]

Have the same issue, is there no way of creating a new correlation id for each new instance of the function app being started/triggered from the service bus messages?

It is near impossible to try find an issue if one message in 10 000 fail or cause an unexpected result

AltusBaard avatar Oct 10 '23 04:10 AltusBaard