Skip to content

grpc: allow the user to cancel stream v2#3823

Closed
aidandj wants to merge 13 commits intoopen-telemetry:mainfrom
aidandj:aidan/allow-the-user-to-cancel-stream-v2
Closed

grpc: allow the user to cancel stream v2#3823
aidandj wants to merge 13 commits intoopen-telemetry:mainfrom
aidandj:aidan/allow-the-user-to-cancel-stream-v2

Conversation

@aidandj
Copy link
Copy Markdown

@aidandj aidandj commented Oct 9, 2025

Description

An updated version of this PR: #2093

Fixes # (issue)

#2014

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

UOndro added 6 commits October 9, 2025 09:19
- set_attribute and also set_status are not called if span was already ended. Simple reorder of function calls helped
- I also realized that accessing end_time is dangerous, in SDK it is protected by lock. I solved this by remembering if we already called end. Calling multiple times end on span is not problematic, but it generates warning logs and is probably not good practice
- updated CHANGELOG.md
- fix lint
@aidandj aidandj requested a review from a team as a code owner October 9, 2025 17:39
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Oct 9, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: aidandj / name: Aidan Jensen (da21d03)

@aidandj aidandj mentioned this pull request Oct 9, 2025
13 tasks
@aidandj aidandj force-pushed the aidan/allow-the-user-to-cancel-stream-v2 branch from 17c89a7 to 6ed2e7d Compare October 9, 2025 17:41
@aidandj aidandj force-pushed the aidan/allow-the-user-to-cancel-stream-v2 branch from 6ed2e7d to 9bdf76a Compare October 9, 2025 17:42
@xrmx xrmx changed the title Aidan/allow the user to cancel stream v2 grpc: allow the user to cancel stream v2 Oct 10, 2025
@xrmx xrmx moved this to Ready for review in Python PR digest Oct 10, 2025
@xrmx xrmx moved this from Ready for review to Reviewed PRs that need fixes in Python PR digest Oct 10, 2025
@xrmx xrmx moved this from Reviewed PRs that need fixes to Ready for review in Python PR digest Oct 10, 2025
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
@aidandj aidandj force-pushed the aidan/allow-the-user-to-cancel-stream-v2 branch from b6cf2e3 to 979f0c6 Compare October 10, 2025 14:17
@aidandj
Copy link
Copy Markdown
Author

aidandj commented Jan 9, 2026

Friendly new years bump on this one.

@aidandj
Copy link
Copy Markdown
Author

aidandj commented Feb 20, 2026

bump

@tordynnar
Copy link
Copy Markdown

It would be amazing if this could be merged. Not being able to cancel when instrumented by OTel is problematic.

@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Mar 11, 2026
@aidandj
Copy link
Copy Markdown
Author

aidandj commented Mar 11, 2026

Not stale

@github-actions github-actions Bot removed the Stale label Mar 12, 2026
},
)

def test_stream_stream_can_be_cancel(self):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
def test_stream_stream_can_be_cancel(self):
def test_stream_can_be_canceled(self):

try:
future.result()
except grpc.FutureCancelledError:
span_.set_status(Status(StatusCode.OK))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think span status as OK makes sense since the choices are unset, ok, or error. Would be good to get others' thoughts on this. The important part is this follows semconv for rpc status code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't believe that canceling a span from the server side should be considered an error, although it may make sense to look at what another language does.

Copy link
Copy Markdown
Contributor

@tammy-baylis-swi tammy-baylis-swi left a comment

Choose a reason for hiding this comment

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

Thank you for this and your patience. Please could you resolve the merge conflicts.

@tammy-baylis-swi tammy-baylis-swi requested a review from a team March 19, 2026 21:54
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Apr 3, 2026
@tammy-baylis-swi tammy-baylis-swi moved this from Ready for review to Reviewed PRs that need fixes in Python PR digest Apr 6, 2026
@github-actions
Copy link
Copy Markdown

This PR has been closed due to inactivity. Please reopen if you would like to continue working on it.

@github-actions github-actions Bot closed this Apr 17, 2026
@github-project-automation github-project-automation Bot moved this from Reviewed PRs that need fixes to Done in Python PR digest Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants