open-telemetry / open-telemetry/opentelemetry-python-contrib
grpc GrpcInstrumentorClient does not call request/response hooks for streaming rpcs
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: Ubuntu
Python version: Python 3.8.18
Package version: 0.48b0
Package: opentelemetry-instrumentation-grpc
What happened?
The request/response hooks added in https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1706/files only seem to work for unary requests, not streaming requests.
Steps to Reproduce
Instrument using GrpcInstrumentorClient, pass request_hook and response_hook, then make a response-streaming rpc with a client.
Expected Result
Calls to the configured hooks. Maybe once per message and again when the request finishes?
Actual Result
No calls to the hooks.
Additional context
It looks like OpenTelemetryClientInterceptor._intercept calls _trace_result, but OpenTelemetryClientInterceptor._intercept_server_stream does not.
Would you like to implement a fix?
No
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 by reading OpenTelemetryClientInterceptor._intercept and _intercept_server_stream, then reproduce the response-streaming RPC using GrpcInstrumentorClient with request_hook and response_hook configured. Trace the streaming path and compare it with _trace_result; done means the configured hooks are called for streaming requests and responses according to an agreed message or completion behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, python
- Domain
- api, observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100