open-telemetry / open-telemetry/opentelemetry-python-contrib
grpc aioserver context the code getting
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 Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.
Steps to reproduce
Make grpc aio server interceptor
Try to get status code from context in interceptor
What is the expected behavior?
https://grpc.github.io/grpc/python/grpc.html?highlight=servicercontext#grpc.ServicerContext.code
Get the code by context.code()
What is the actual behavior?
TypeError: 'StatusCode' object is not callable
Additional context
class opentelemetry.instrumentation.grpc._server._OpenTelemetryServicerContext doesn't have code method but have code preperty.
And _OpenTelemetryServicerContext inherits grpc.ServicerContext instead of grpc.aio.ServicerContext
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
The relevant entry point is opentelemetry.instrumentation.grpc._server._OpenTelemetryServicerContext; first compare its aio usage with grpc.aio.ServicerContext and reproduce context.code() in an aio interceptor. Done means the wrapped aio context exposes the documented status-code API without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100