open-telemetry / open-telemetry/opentelemetry-python-contrib
gRPC: disable_next_message_compression() raises AttributeError with server instrumentation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Describe your environment
OS: macOS
Python version: 3.12.14
Package version: opentelemetry-instrumentation-grpc 0.63b1
What happened?
Calling context.disable_next_message_compression() in a synchronous gRPC handler raises AttributeError when server instrumentation is enabled.
Steps to Reproduce
- Create a synchronous gRPC server with the OpenTelemetry
server_interceptor(). - Call
context.disable_next_message_compression()inside a handler. - Invoke the RPC.
Expected Result
The call succeeds, as it does without instrumentation.
Actual Result
The handler raises AttributeError, and the RPC fails with UNKNOWN.
Additional context
The instrumented context delegates this method through _service_context, but the underlying context is stored in _servicer_context.
Would you like to implement a fix?
Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the gRPC server_interceptor() and the instrumented context implementation, then trace how disable_next_message_compression() delegates to the underlying context. Add coverage for a synchronous handler with server instrumentation, and verify that invoking the method succeeds without an AttributeError or UNKNOWN RPC failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, python
- Domain
- api, observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100