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

Some fields of dependency telemetry are missing when dependency is invoked asynchronously

Open a-stankevich opened this issue 1 year ago • 2 comments

  • List of NuGet packages and version that you are using:
    • Microsoft.ApplicationInsights.Web 2.21.0 and it's dependencies
  • Runtime version (e.g. net461, net48, netcoreapp2.1, netcoreapp3.1, etc. You can find this information from the *.csproj file):
    • net48
  • Hosting environment (e.g. Azure Web App, App Service on Linux, Windows, Ubuntu, etc.):
    • Azure Web App
    • Windows

Describe the bug

While processing request application can make calls to external dependencies, like HTTP or SQL servers. When such calls are done in a synchronous manner (e.g. using WebClient.DownloadData(), EF DbSet.ToList()) corresponding dependency telemetry includes Operation Id as well as Operation Name, User Id, Session Id from request. When such calls are done in asynchronous manner (e.g. using HttpClient.GetAsync(), EF DbSet.ToListAsync()) corresponding dependency telemetry includes only Operation Id, but not Operation Name, User Id, Session Id from request.

This happens at least for HTTP, SQL dependencies. Example screenshot of dependency telemetry for one request: image

To Reproduce

The issue is reproducible with ASP.Net MVC / Web API: https://github.com/a-stankevich/MissingTelemetry The issue does not seem to happen with ASP.Net Core.

a-stankevich avatar Mar 02 '23 16:03 a-stankevich

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 Dec 28 '23 00:12 github-actions[bot]

I'd like this to stay open please

a-stankevich avatar Dec 28 '23 14:12 a-stankevich