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

grpc GrpcInstrumentorClient does not call request/response hooks for streaming rpcs

Open
#2,948 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.