Processing errors adds duplicate error.type diagnostic tags to kestrel.connection.duration in Microsoft.AspNetCore.Server.Kestrel #57558
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Is there an existing issue for this?
Describe the bug
In case of processing errors,
Microsoft.AspNetCore.Server.Kestrel
diagnostic metrics contain duplicates oferror.type
in the output statistics forkestrel.connection.duration
, both when viewed by standard diagnostic tools and when publishing values toPrometheus
/OpenTelemetry
, which leads to failures due to duplication error.The issue is similar to the situation in #55159.
Examples of publishing to prometheus:
The application works fine with .NET 8, the issue occurs when migrating to .NET 9 Preview 7
Expected Behavior
The tags on the metrics should not be duplicated
Steps To Reproduce
dotnet run
Attach using
dotnet-counters collect -n DuplicateTagRepro Microsoft.AspNetCore.Server.Kestrel
(or any other tooling that allows seeing theMicrosoft.AspNetCore.Server.Kestrel
metrics.Simulate errors, e.g., by running the following code 1 or more times, adjusting the connection port to match the running application (see step 1)
Microsoft.AspNetCore.Server.Kestrel,kestrel.connection.duration
metrics with duplicatederror.type=invalid_request_line
tagsE.g.
Microsoft.AspNetCore.Server.Kestrel,kestrel.connection.duration (s)[error.type=invalid_request_line;error.type=invalid_request_line;network.protocol.name=http;network.protocol.version=1.1;network.transport=tcp;network.type=ipv4;server.address=127.0.0.1;server.port=62203;Percentile=95],Metric,0.00519561767578125
Exceptions (if any)
No response
.NET Version
9.0.100-preview.7.24407.12
Anything else?
No response
The text was updated successfully, but these errors were encountered: