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

Dependency telemetry from a background service is correlated with the first request

Open kblooie opened this issue 6 years ago • 2 comments

We use the RavenDB.Client library for data access, which uses HttpClient underneath. Dependency telemetry works great for normal calls. However, the RavenDB library has an ongoing background thread that makes an http request every 10 minutes to get information about the topology of it's cluster. These http requests are sent as dependency telemetry, but they are correlated with the first request telemetry made in the application since the last restart. This greatly skews our response times and adds hundreds of dependency calls to the first request. Since there are hundreds of dependencies correlated to it, it results in making the UI extremely slow when attempting to look at the request timeline.

The RavenDB client is a singleton that is lazily created on startup.

What can I do to ensure that these background requests are not correlated to ANY requests?

I've tried writing a telemetry initializer that sets the parentId to null for these background requests, but that doesn't seem to affect the correlation in the UI.

Version Info

SDK Version : 2.12.1 .NET Version : 4.7.2 How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) : Manually OS : Windows Hosting Info (IIS/Azure WebApps/ etc) : IIS & Windows Service

kblooie avatar Feb 13 '20 02:02 kblooie

Can you share how you set parentid to null for these background calls? If parentid is indeed set to null, then UI shouldn't be able to correlate it to any parent. (We still need to investigate why the parentid from 1st request is still persisting..)

cijothomas avatar Feb 24 '20 21:02 cijothomas

This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 16 '21 00:09 github-actions[bot]