From df9c531019787afe40a32282837c2a31f5fba450 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Fri, 22 Nov 2024 15:18:05 +0100 Subject: [PATCH] Fix socket --- sentry_sdk/integrations/socket.py | 4 +++- tests/integrations/socket/test_socket.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sentry_sdk/integrations/socket.py b/sentry_sdk/integrations/socket.py index cba448c3a3..335fd643aa 100644 --- a/sentry_sdk/integrations/socket.py +++ b/sentry_sdk/integrations/socket.py @@ -59,7 +59,9 @@ def create_connection( origin=SocketIntegration.origin, only_if_parent=True, ) as span: - span.set_data("address", address) + host, port = address + span.set_data("address.host", host) + span.set_data("address.port", port) span.set_data("timeout", timeout) span.set_data("source_address", source_address) diff --git a/tests/integrations/socket/test_socket.py b/tests/integrations/socket/test_socket.py index 389256de33..e629114b2b 100644 --- a/tests/integrations/socket/test_socket.py +++ b/tests/integrations/socket/test_socket.py @@ -42,9 +42,9 @@ def test_create_connection_trace(sentry_init, capture_events): assert connect_span["description"] == "example.com:443" assert connect_span["data"] == ApproxDict( { - "address": ["example.com", 443], + "address.host": "example.com", + "address.port": 443, "timeout": timeout, - "source_address": None, } )