Skip to content

fix(grpc): handle NotImplementedError from add_done_callback in aio client#4429

Open
alliasgher wants to merge 1 commit intoopen-telemetry:mainfrom
alliasgher:fix-grpc-aio-add-done-callback
Open

fix(grpc): handle NotImplementedError from add_done_callback in aio client#4429
alliasgher wants to merge 1 commit intoopen-telemetry:mainfrom
alliasgher:fix-grpc-aio-add-done-callback

Conversation

@alliasgher
Copy link
Copy Markdown

Fixes #3915. When a user provides a grpc.aio interceptor that awaits the call object, the resulting type may not implement add_done_callback. Catch NotImplementedError and invoke the callback immediately with the already-available code and details.

@xrmx
Copy link
Copy Markdown
Contributor

xrmx commented Apr 14, 2026

This is missing a test for checking this is working fine now and conflict handling in the CHANGELOG

…lient

When a user provides a custom grpc.aio interceptor that awaits the call
object (e.g. `call = await continuation(...); return await call`), the
resulting call object may not implement add_done_callback, raising
NotImplementedError.

Catch the exception and invoke the callback immediately in that case.
The code and details are already available at that point so the span
can still be finalised correctly.

Fixes open-telemetry#3915

Signed-off-by: alliasgher <alliasgher123@gmail.com>
@alliasgher alliasgher force-pushed the fix-grpc-aio-add-done-callback branch from fe37463 to c788d60 Compare April 14, 2026 08:46
@alliasgher
Copy link
Copy Markdown
Author

I think the comment about #47040 was meant for a different PR (it's a collector-contrib PR fixing the azurefunctions config round-trip, unrelated to this grpc aio fix). Happy to proceed here if that's correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

opentelemetry-instrumentation-grpc: Client unary call throws NotImplementedError

2 participants