[release/9.0] Fix duplicate error.type on kestrel.connection.duration #57581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #57561 to release/9.0
/cc @JamesNK
Fix duplicate error.type on kestrel.connection.duration
kestrel.connection.duration
is a metric introduced in .NET 8. It captures how long a connection lasted along with connection metadata. In .NET 9, the metric now records now more information about connection errors.The issue is the
error.type
tag could be added to the metric twice, which causes some tooling in the OTEL ecosystem to error.The fix is to ensure that only one
error.type
tag is present.Fixes #57558
Customer Impact
Tooling that uses metrics, such as Prometheus, will error if there are duplicate tag. The customer must be forced to disable that metric.
This issue was introduced in the last .NET 9 preview and there is already one customer reporting it.
Regression?
Although the extra detail in
error.type
is new in .NET 9, customers successfully usingkestrel.connection.duration
in .NET 8 will be broken after upgrading to .NET 9.Risk
Product change is to double check if
error.type
is present before adding it.Verification
Manual testing:
Before: (two
error.type
values per line in result)After: (one
error.type
value per line in result)Packaging changes reviewed?
When servicing release/2.1