Skip to content

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
@dotnet-policy-service
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
Contributor

@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
Contributor

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@antonfirsov
Copy link
Contributor

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@antonfirsov
Copy link
Contributor

Outerloop failures are also unrelated.

@antonfirsov antonfirsov merged commit e16eeab into dotnet:main Jun 10, 2025
87 of 94 checks passed
@joegoldman2 joegoldman2 deleted the fix/116205 branch June 10, 2025 17:37
antonfirsov added a commit that referenced this pull request Jul 4, 2025
Depending on the timing of the cancellation, the exception type can be either `OperationCanceledException` or `TaskCanceledExcption`, we need to allow both. The PR also refactors the assertions outside of the `ActivityListener` callback, so we get better error messages if something fails in the future. (This test has been recently added in #116269.)
@github-actions github-actions bot locked and limited conversation to collaborators Jul 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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