microsoft / ApplicationInsights-dotnet-server

Microsoft Application Insights for .NET Web Applications
https://azure.microsoft.com/services/application-insights/
133 stars 67 forks source link

x-correlation-id header added too many times #1216

Closed abergs closed 5 years ago

abergs commented 5 years ago

We have an API endpoint which makes a lot of dependency calls (SQL, Redis etc). The result is that over 1,200 x-correlation-id headers are added to the response. Our client ( a .NET Core 2.2 app HttpClient) throws exceptions because the value of the header is larger than the maximum defined in HttpClient: https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs#L519

Repro Steps

  1. Unknown (Make a lot of dependency calls perhaps? )

Actual Behavior

Adds over 1,200 "x-correlation-id: GUID-XXX-XXX-XXX-XXX"

Expected Behavior

Adds one or a limited amount of "x-correlation-id: GUID-XXXX-XXXX-XXX-XXX-XXX"

Version Info

SDK Version : 2.8.1 .NET Version : 4.7.1
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) : OS : Visual Studio / Nuget Hosting Info (IIS/Azure WebApps/ etc) : Azure webapp (and IIS Express localhost)

cijothomas commented 5 years ago

@lmolkova - can you take a look?

lmolkova commented 5 years ago

ApplicationInsights SDKs or .NET never add x-correlation-id headers. @abergs are you sure this is the right header name? Please check if anything else in your app adds this header.

abergs commented 5 years ago

You are right. I grep'd after x-correlation-id and couldn't find anything. However it seems another nuget package adds the header. Sorry for disturbing.