open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
727 stars 596 forks source link

grpc aioserver context the code getting #1475

Open ezinall opened 1 year ago

ezinall commented 1 year ago

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

cookiefission commented 11 months ago

I think the behaviour of code was fixed in https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1578 .

There is an arity issue with abort for the AIO servicer context which is probably caused by the inheritance mismatch mentioned here. I'll raise a separate issue for that.

ezinall commented 3 weeks ago

@cookiefission can i close issue?