Skip to content
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

[release/9.0] Fix duplicate error.type on kestrel.connection.duration #57581

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 29, 2024

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?

  • Yes
  • No

Although the extra detail in error.type is new in .NET 9, customers successfully using kestrel.connection.duration in .NET 8 will be broken after upgrading to .NET 9.

Risk

  • High
  • Medium
  • Low

Product change is to double check if error.type is present before adding it.

Verification

  • Manual (required)
  • Automated

Manual testing:

Before: (two error.type values per line in result)

Timestamp,Provider,Counter Name,Counter Type,Mean/Increment
1/9/2024 10:00:36 pm,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=5001;Percentile=50],Metric,0.0296630859375
1/9/2024 10:00:36 pm,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=5001;Percentile=95],Metric,0.0296630859375
1/9/2024 10:00:36 pm,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=5001;Percentile=99],Metric,0.0296630859375

After: (one error.type value per line in result)

Timestamp,Provider,Counter Name,Counter Type,Mean/Increment
1/9/2024 9:57:02 pm,Microsoft.AspNetCore.Server.Kestrel,kestrel.queued_connections ({connection})[network.transport=tcp;network.type=ipv4;server.address=127.0.0.1;server.port=5001],Metric,0
1/9/2024 9:57:02 pm,Microsoft.AspNetCore.Server.Kestrel,kestrel.connection.duration (s)[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=5001;Percentile=50],Metric,0.0088043212890625
1/9/2024 9:57:02 pm,Microsoft.AspNetCore.Server.Kestrel,kestrel.connection.duration (s)[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=5001;Percentile=95],Metric,0.0088043212890625
1/9/2024 9:57:02 pm,Microsoft.AspNetCore.Server.Kestrel,kestrel.connection.duration (s)[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=5001;Percentile=99],Metric,0.0088043212890625

Packaging changes reviewed?

  • Yes
  • No
  • N/A

When servicing release/2.1

  • Make necessary changes in eng/PatchConfig.props

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Aug 29, 2024
@JamesNK JamesNK added the Servicing-consider Shiproom approval is required for the issue label Aug 29, 2024
@JamesNK JamesNK modified the milestones: 9.0-rc1, 9.0-rc2 Sep 2, 2024
@JamesNK JamesNK added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 3, 2024
@JamesNK
Copy link
Member

JamesNK commented Sep 3, 2024

Approved over email.

@wtgodbe wtgodbe merged commit e31c6a4 into release/9.0 Sep 3, 2024
25 checks passed
@wtgodbe wtgodbe deleted the backport/pr-57561-to-release/9.0 branch September 3, 2024 19:00
@dotnet-policy-service dotnet-policy-service bot modified the milestone: 9.0-rc2 Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants