Skip to content

Record OperationCanceledException in HttpClient native instrumentation #116269

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

joegoldman2
Copy link
Contributor

Fixes #116205.

Not sure if it should be considered as a breaking (behavioral) change but with this change, when an OperationCanceledException occurs, Activity.Status, error.type tag, and exception event will be set. For example, for .NET 10+, this logic will no longer be necessary: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/3df15a11fd77557d922f8e414914741e18ba1604/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs#L183-L193.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 3, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@joegoldman2
Copy link
Contributor Author

@antonfirsov this PR is ready to be reviewed.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming tests are passing.

Not sure if it should be considered as a breaking (behavioral) change [...] For example, for .NET 10+, this logic will no longer be necessary

Given that folks typically depend on that OTel polyfill logic anyways and with this PR we are now doing mostly the same, IMO it is unlikely to break many people.

@joegoldman2
Copy link
Contributor Author

Failures in CI look unrelated.

@antonfirsov
Copy link
Member

/azp run runtime-libraries-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net.Http community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OperationCanceledException not captured with HTTP native instrumentation
2 participants