-
Notifications
You must be signed in to change notification settings - Fork 798
Allow the user to cancel stream #2093
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
base: main
Are you sure you want to change the base?
Allow the user to cancel stream #2093
Conversation
@UOndro Please fix failing tests, linting and add a CHANGELOG entry |
- 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
Hi @xrmx, It should be fixed, also updated changelog |
@UOndro thank you for the PR and apologies for not taking a look sooner.
I think the
Can we call |
If I comment out the shutdown of grpc server, the test still fails. The reason is that Not sure if we want to close the server before getting spans, it doesn't look right.
Can you maybe explain this? I am not sure what to do. Ideally, we would have some function/future that would tell us that the done callback was called. I could add something to Here is the code where I commented out the stop of server -> 28b5686 cc. @aabmass |
I fixed the tests and brought this up to main here: aidandj@d7900f9 Should I create a new PR? Or a PR onto this branch? Seems like this is close enough it should be pushed through. |
Updated PR here if that's prefered: #3823 |
Description
Currently, the user was not able to cancel the stream. The cause was that instead of returning
_MultiThreadedRendezvous
we returned the generator created from it.I tried two options to fix this:
_MultiThreadedRendezvous
in proxy, and ending span on all places where it was needed. Because this happened in the same thread, I did not have problems with unit testing.The first solution is definitely less complicated from the point of implementation. However, I am not even sure if waiting for
channel_spin
is correct, spans in theory can be ended a little bit later. Compared to the second solution, we don't need to handle every place where the stream can end, we basically leave this to grpc implementation.In the end, I picked the second solution mostly because it can be testable, it ends span almost immediately when the stream ends, and also because of that bug when done callback is not called when using the single threaded channel.
If you prefer the first solution or have some other in mind, let me know.
Fixes #2014
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.