Skip to content

Commit 53e4b08

Browse files
Edited client
1 parent e8a48c9 commit 53e4b08

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_aio_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ async def intercept_unary_unary(
165165

166166
start_time = time.perf_counter()
167167
method = client_call_details.method
168+
if isinstance(method, bytes):
169+
method = method.decode()
168170

169171
with self._start_interceptor_span(method) as span:
170172
new_details = self.propagate_trace_in_details(client_call_details)
@@ -193,6 +195,8 @@ async def intercept_unary_stream(
193195

194196
start_time = time.perf_counter()
195197
method = client_call_details.method
198+
if isinstance(method, bytes):
199+
method = method.decode()
196200

197201
with self._start_interceptor_span(method) as span:
198202
new_details = self.propagate_trace_in_details(client_call_details)
@@ -218,6 +222,8 @@ async def intercept_stream_unary(
218222

219223
start_time = time.perf_counter()
220224
method = client_call_details.method
225+
if isinstance(method, bytes):
226+
method = method.decode()
221227

222228
with self._start_interceptor_span(method) as span:
223229
new_details = self.propagate_trace_in_details(client_call_details)
@@ -243,6 +249,8 @@ async def intercept_stream_stream(
243249

244250
start_time = time.perf_counter()
245251
method = client_call_details.method
252+
if isinstance(method, bytes):
253+
method = method.decode()
246254

247255
with self._start_interceptor_span(method) as span:
248256
new_details = self.propagate_trace_in_details(client_call_details)

instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ def _trace_result(self, span, rpc_info, result):
170170
return result
171171

172172
def _build_metric_attributes(self, method, status_code):
173-
if isinstance(method, bytes):
174-
method = method.decode()
175173
full_method = method.lstrip("/") if method else _DEFAULT_RPC_METHOD
176174
attrs = {
177175
RPC_SYSTEM_NAME: RpcSystemNameValues.GRPC.value,

0 commit comments

Comments
 (0)