open-telemetry / open-telemetry/opentelemetry-python-contrib

gRPC: disable_next_message_compression() raises AttributeError with server instrumentation

Open Beginner friendly
#5,034 0 comments 0 reactions 0 assignees View on GitHub

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
  1. Create a synchronous gRPC server with the OpenTelemetry server_interceptor().
  2. Call context.disable_next_message_compression() inside a handler.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.