Description
Describe the bug: I'm trying to add elastic apm for my gRPC service with unary-to-unary requests and stream-to-stream. Everything is fine with unary-to-unary requests. But stream-to-stream requests stop working.
The service stops accepting streaming requests altogether.
I think I saw somewhere that you wrote elastic does not support stream requests for gRPC. But I didn't think it would be a service-blocking problem.
Is there any way to get around it, to make custom processing for stream specifically?
To Reproduce
- Create a gRPC service with stream-to-stream and unary-to-unary endpoints.
class TestService(test_pb2_grpc.TestService):
async def Streaming(self, request_iterator, context):
count_of_request = 0
async for request in request_iterator:
count_of_request += 1
yield test_pb2.Response(message=f"#{count_of_request } - ok")
async def Unary(self, request, context):
return test_pb2.Response(message="ok")
- Connect elastic apm.
elasticapm.instrument()
async def run_serve():
apm_client = GRPCApmClient(
{
"SERVICE_NAME": "grpc-test",
"SERVER_URL": "http://localhost:8200",
"ENVIRONMENT": "test",
"TRANSACTION_SAMPLE_RATE": 1.0,
"SECRET_TOKEN": "qwerty",
}
)
server = grpc.aio.server(
futures.ThreadPoolExecutor(max_workers=10),
)
test_pb2_grpc.add_TestServicer_to_server(
TestService(), server
)
server.add_insecure_port("[::]:50051")
await server.start()
await server.wait_for_termination()
if __name__ == "__main__":
asyncio.run(run_serve())
- Make test requests
- Result: unary - works, stream - returns nothing, no logs in the service
Environment (please complete the following information)
- OS: Linux
- Python version: 3.10
- Framework and version: gRPC 1.43.0
- APM Server version: 6.20.0
Additional context
Add any other context about the problem here.
-
requirements.txt
:Click to expand
gcloud==0.18.3 google-api-python-client==2.39.0 grpcio-tools==1.43.0 grpcio-health-checking==1.43.0 setuptools==59.5.0 elastic-apm sentry-sdk[grpcio]==1.31.0