Skip to content

Commit

Permalink
fix(grpc): Return propagate proper metadata object instead of list in…
Browse files Browse the repository at this point in the history
… client interceptor

Fixes getsentry#2509
  • Loading branch information
fdellekart committed Jul 3, 2024
1 parent a0c836b commit c8fc77d
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions sentry_sdk/integrations/grpc/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ClientCallDetails,
UnaryUnaryCall,
UnaryStreamCall,
Metadata,
)
from google.protobuf.message import Message

Expand All @@ -20,20 +21,10 @@ class ClientInterceptor:
def _update_client_call_details_metadata_from_scope(
client_call_details: ClientCallDetails,
) -> ClientCallDetails:
metadata = (
list(client_call_details.metadata) if client_call_details.metadata else []
)
if client_call_details.metadata is None:
client_call_details = client_call_details._replace(metadata=Metadata())
for key, value in Scope.get_current_scope().iter_trace_propagation_headers():
metadata.append((key, value))

client_call_details = ClientCallDetails(
method=client_call_details.method,
timeout=client_call_details.timeout,
metadata=metadata,
credentials=client_call_details.credentials,
wait_for_ready=client_call_details.wait_for_ready,
)

client_call_details.metadata.add(key, value)
return client_call_details


Expand Down

0 comments on commit c8fc77d

Please sign in to comment.