From 9089d6cf321c41836c44aee06aabc2526d401172 Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 25 Jun 2025 16:23:05 +0300 Subject: [PATCH] Update common_utils.py When OpenTelemetry intercepts grpc stream calls it returns generator. So in `GrpcWrapperAsyncIO.close` in case of intercepted call `self._stream_call` have no method `cancel` but have method `close`. --- ydb/_grpc/grpcwrapper/common_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ydb/_grpc/grpcwrapper/common_utils.py b/ydb/_grpc/grpcwrapper/common_utils.py index 7fb5b684..0dff5575 100644 --- a/ydb/_grpc/grpcwrapper/common_utils.py +++ b/ydb/_grpc/grpcwrapper/common_utils.py @@ -174,7 +174,12 @@ async def start(self, driver: SupportedDriverType, stub, method): def close(self): self.from_client_grpc.put_nowait(_stop_grpc_connection_marker) if self._stream_call: - self._stream_call.cancel() + if hasattr(self._stream_call, "cancel"): + # for ordinal grpc calls + self._stream_call.cancel() + elif hasattr(self._stream_call, "close"): + # for OpenTelemetry intercepted grpc calls (generator) + self._stream_call.close() self._clean_executor(wait=True)