-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Elastic APM OpenTelemetry Error: An item with the same key has already been added. Key: error.type #2221
Comments
Was this problem solved in version 1.25.1? Or was that for another bug fix? One of main concerns here is that in interferes with normal code execution. A package like this should never alter the application flow. There should be a global catch to prevent the normal operations from failing and produce a logging error elsewhere. |
I've tested this out with version |
We encountered the same issue since last Friday, The error message: The stack trace:
The source code reference:
An issue was reported and fixed two weeks ago in azure-sdk-for-net, but has not yet been released. According to lmolkova |
@zhangpengchen thanks for the update and reference. Although I agree this might fix this problem. But it doesn't solve the fact that a telemetry function of the app can break the normal app flow. This shouldn't be the case. This exception should have been caught and logged as error. |
APM Agent version
The version of the
Elastic.Apm
nuget package used1.25.0
Environment
Operating system and version:
Microsoft Windows 11
.NET Framework/Core name and version (e.g. .NET 4.6.2, NET Core 3.1.100) :
NET Core 7.0.13
Application Target Framework(s) (e.g. net462, netcoreapp3.1):
net7.0
Describe the bug
When starting an app with an elastic apm agent configured and using asp.net core dataprotection with azure key vault I get an error
that I think is related to the Elastic APM agent itself. It seems that the OpenTelemetry
ActivityListener
is trying to add duplicate keys in a dictionary triggering this Exception. Because of this the entire application is unusable.Error details
Exception:
Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider An error occurred while reading the key ring. System.ArgumentException: An item with the same key has already been added. Key: error.type
Exception StackTrace:
I tried reproducing this error by getting the agent source and debugging the code. The data that was being added was:
Origin of the error
The source ode reference: ElasticActivityListener.cs line 157
The data that was added to the dictionary (duplicate error.key Key)
To Reproduce
This is not related to Azure Key Vault only. Similar behavior was noticed when using Service bus to create a subscription for a topic.
Expected behavior
It's not clear why those keys are duplicated. Maybe they should be checked first before adding.
Actual behavior
The asp.net core request pipeline keeps crashing.
The text was updated successfully, but these errors were encountered: