From 68f6194fe0ddc7fa60ce2c625c8aeaeaf3c2f674 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 11:02:42 +0200 Subject: [PATCH 1/8] ref: Assign server_name to the device.name attribute to avoid server.address conflicts --- sentry_sdk/consts.py | 6 ++++++ sentry_sdk/scope.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 82a9f27ec8..871c36ede8 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -539,6 +539,12 @@ class SPANDATA: Example: my_user """ + DEVICE_NAME = "device.name" + """ + The name of the device. On mobile, this is the user-assigned device name. On servers and desktops, this is typically the hostname. + Example: "localhost" + """ + GEN_AI_AGENT_NAME = "gen_ai.agent.name" """ The name of the agent being used. diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 9587ed84fd..11bb01631f 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -392,7 +392,7 @@ def set_global_attributes(self) -> None: server_name = options.get("server_name") if server_name: - self.set_attribute(SPANDATA.SERVER_ADDRESS, server_name) + self.set_attribute(SPANDATA.DEVICE_NAME, server_name) environment = options.get("environment") if environment: From 757f878d61361504b74edcb30987e01cceef64d3 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 14:51:57 +0200 Subject: [PATCH 2/8] fix tests --- tests/integrations/aiomysql/test_aiomysql.py | 4 +- tests/integrations/asyncpg/test_asyncpg.py | 4 +- tests/integrations/boto3/test_s3.py | 4 +- .../test_clickhouse_driver.py | 161 +++++++++--------- tests/integrations/grpc/test_grpc.py | 8 +- tests/integrations/grpc/test_grpc_aio.py | 6 +- .../huggingface_hub/test_huggingface_hub.py | 14 +- tests/integrations/logging/test_logging.py | 8 +- tests/integrations/loguru/test_loguru.py | 8 +- tests/integrations/socket/test_socket.py | 7 +- tests/test_logs.py | 4 +- tests/test_metrics.py | 2 +- tests/test_transport.py | 6 +- tests/tracing/test_decorator.py | 14 +- tests/tracing/test_span_streaming.py | 3 +- 15 files changed, 129 insertions(+), 124 deletions(-) diff --git a/tests/integrations/aiomysql/test_aiomysql.py b/tests/integrations/aiomysql/test_aiomysql.py index 32f2a22538..deadbb6162 100644 --- a/tests/integrations/aiomysql/test_aiomysql.py +++ b/tests/integrations/aiomysql/test_aiomysql.py @@ -47,7 +47,7 @@ def _get_db_name(): "db.name": MYSQL_DB, "db.system": "mysql", "db.user": MYSQL_USER, - "server.address": MYSQL_HOST, + SPANDATA.DEVICE_NAME: MYSQL_HOST, "server.port": MYSQL_PORT, } ), @@ -685,7 +685,7 @@ async def test_connection_pool(sentry_init, capture_events) -> None: assert len(connect_crumbs) >= pool_size # One connect span per pooled connection for crumb in connect_crumbs: assert crumb["data"]["db.system"] == "mysql" - assert crumb["data"]["server.address"] == MYSQL_HOST + assert crumb["data"][SPANDATA.DEVICE_NAME] == MYSQL_HOST @pytest.mark.asyncio diff --git a/tests/integrations/asyncpg/test_asyncpg.py b/tests/integrations/asyncpg/test_asyncpg.py index 1991b9af05..b9ee4d34a8 100644 --- a/tests/integrations/asyncpg/test_asyncpg.py +++ b/tests/integrations/asyncpg/test_asyncpg.py @@ -51,7 +51,7 @@ def _get_db_name(): "db.system": "postgresql", "db.user": PG_USER, "db.driver.name": "asyncpg", - "server.address": PG_HOST, + SPANDATA.DEVICE_NAME: PG_HOST, "server.port": PG_PORT, } ), @@ -68,7 +68,7 @@ def _get_db_name(): "db.namespace": PG_NAME, "db.user": PG_USER, "db.driver.name": "asyncpg", - "server.address": PG_HOST, + SPANDATA.DEVICE_NAME: PG_HOST, "server.port": PG_PORT, } ), diff --git a/tests/integrations/boto3/test_s3.py b/tests/integrations/boto3/test_s3.py index aeab5f58a1..1f2c77f944 100644 --- a/tests/integrations/boto3/test_s3.py +++ b/tests/integrations/boto3/test_s3.py @@ -125,7 +125,7 @@ def test_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -283,7 +283,7 @@ def test_omit_url_data_if_parsing_fails( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py index 1cec232548..4092107749 100644 --- a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py +++ b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py @@ -13,6 +13,7 @@ import sentry_sdk from sentry_sdk import capture_message, start_transaction +from sentry_sdk.consts import SPANDATA from sentry_sdk.integrations.clickhouse_driver import ClickhouseDriverIntegration from tests.conftest import ApproxDict @@ -49,7 +50,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -62,7 +63,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -75,7 +76,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -88,7 +89,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -101,7 +102,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -155,7 +156,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -168,7 +169,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -181,7 +182,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -194,7 +195,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -207,7 +208,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [[370]], "db.params": {"minv": 150}, @@ -258,7 +259,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -271,7 +272,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -284,7 +285,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -297,7 +298,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -310,7 +311,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [[370]], "db.params": {"minv": 150}, @@ -361,7 +362,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -373,7 +374,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -385,7 +386,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -397,7 +398,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -409,7 +410,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -461,7 +462,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -473,7 +474,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -485,7 +486,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -497,7 +498,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -509,7 +510,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -560,7 +561,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -573,7 +574,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -586,7 +587,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -599,7 +600,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -612,7 +613,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [[370]], "db.params": {"minv": 150}, @@ -783,7 +784,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "DROP TABLE IF EXISTS test", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -799,7 +800,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -815,7 +816,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "INSERT INTO test (x) VALUES", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -831,7 +832,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "INSERT INTO test (x) VALUES", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -847,7 +848,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -904,7 +905,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -920,7 +921,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -936,7 +937,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -952,7 +953,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -968,7 +969,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1072,7 +1073,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "DROP TABLE IF EXISTS test", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "thread.id": mock.ANY, "thread.name": mock.ANY, @@ -1087,7 +1088,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "thread.id": mock.ANY, "thread.name": mock.ANY, @@ -1102,7 +1103,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "INSERT INTO test (x) VALUES", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "thread.id": mock.ANY, "thread.name": mock.ANY, @@ -1117,7 +1118,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "INSERT INTO test (x) VALUES", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1130,7 +1131,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1186,7 +1187,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -1202,7 +1203,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [], }, @@ -1218,7 +1219,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -1234,7 +1235,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -1250,7 +1251,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": {"minv": 150}, "db.result": [[370]], @@ -1304,7 +1305,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -1317,7 +1318,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -1330,7 +1331,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -1343,7 +1344,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -1356,7 +1357,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -1405,7 +1406,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1418,7 +1419,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1431,7 +1432,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -1444,7 +1445,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -1457,7 +1458,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": {"minv": 150}, "db.result": [[["370"]], [["'sum(x)'", "'Int64'"]]], @@ -1528,7 +1529,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "DROP TABLE IF EXISTS test", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1544,7 +1545,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1560,7 +1561,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1576,7 +1577,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1592,7 +1593,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1649,7 +1650,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1665,7 +1666,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1681,7 +1682,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1697,7 +1698,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1713,7 +1714,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1787,7 +1788,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "DROP TABLE IF EXISTS test", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1802,7 +1803,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1817,7 +1818,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1832,7 +1833,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1847,7 +1848,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1903,7 +1904,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1919,7 +1920,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1935,7 +1936,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -1951,7 +1952,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -1967,7 +1968,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - "server.address": "localhost", + SPANDATA.DEVICE_NAME: "localhost", "server.port": 9000, "db.params": {"minv": 150}, "db.result": [[[370]], [["sum(x)", "Int64"]]], diff --git a/tests/integrations/grpc/test_grpc.py b/tests/integrations/grpc/test_grpc.py index f50a2f62d1..448e2d9c87 100644 --- a/tests/integrations/grpc/test_grpc.py +++ b/tests/integrations/grpc/test_grpc.py @@ -8,7 +8,7 @@ import sentry_sdk from sentry_sdk import start_span, start_transaction -from sentry_sdk.consts import OP +from sentry_sdk.consts import OP, SPANDATA from sentry_sdk.integrations.grpc import GRPCIntegration from sentry_sdk.integrations.grpc.client import ClientInterceptor from sentry_sdk.tracing_utils import has_span_streaming_enabled @@ -316,7 +316,7 @@ def test_grpc_client_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", @@ -400,7 +400,7 @@ def test_grpc_client_unary_stream_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -494,7 +494,7 @@ def test_grpc_client_other_interceptor( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", diff --git a/tests/integrations/grpc/test_grpc_aio.py b/tests/integrations/grpc/test_grpc_aio.py index 217dc110d2..e7a8d0db0e 100644 --- a/tests/integrations/grpc/test_grpc_aio.py +++ b/tests/integrations/grpc/test_grpc_aio.py @@ -8,7 +8,7 @@ import sentry_sdk from sentry_sdk import start_span, start_transaction -from sentry_sdk.consts import OP +from sentry_sdk.consts import OP, SPANDATA from sentry_sdk.integrations.grpc import GRPCIntegration from sentry_sdk.tracing_utils import has_span_streaming_enabled from tests.conftest import ApproxDict @@ -341,7 +341,7 @@ async def test_grpc_client_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", @@ -416,7 +416,7 @@ async def test_grpc_client_unary_stream_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/integrations/huggingface_hub/test_huggingface_hub.py b/tests/integrations/huggingface_hub/test_huggingface_hub.py index 8d8e6a9b2e..13f3ce25fc 100644 --- a/tests/integrations/huggingface_hub/test_huggingface_hub.py +++ b/tests/integrations/huggingface_hub/test_huggingface_hub.py @@ -532,7 +532,7 @@ def test_text_generation( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -671,7 +671,7 @@ def test_text_generation_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -814,7 +814,7 @@ def test_chat_completion( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -965,7 +965,7 @@ def test_chat_completion_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1114,7 +1114,7 @@ def test_chat_completion_api_error( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1315,7 +1315,7 @@ def test_chat_completion_with_tools( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1477,7 +1477,7 @@ def test_chat_completion_streaming_with_tools( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/integrations/logging/test_logging.py b/tests/integrations/logging/test_logging.py index 661fc53f57..02ed6adcb0 100644 --- a/tests/integrations/logging/test_logging.py +++ b/tests/integrations/logging/test_logging.py @@ -5,7 +5,7 @@ import pytest from sentry_sdk import get_client -from sentry_sdk.consts import VERSION +from sentry_sdk.consts import SPANDATA, VERSION from sentry_sdk.integrations.logging import ( LoggingIntegration, ignore_logger, @@ -572,9 +572,9 @@ def test_logger_with_all_attributes(sentry_init, capture_items): assert isinstance(attributes["sentry.release"], str) del attributes["sentry.release"] - assert "server.address" in attributes - assert isinstance(attributes["server.address"], str) - del attributes["server.address"] + assert SPANDATA.DEVICE_NAME in attributes + assert isinstance(attributes[SPANDATA.DEVICE_NAME], str) + del attributes[SPANDATA.DEVICE_NAME] assert "thread.id" in attributes assert isinstance(attributes["thread.id"], int) diff --git a/tests/integrations/loguru/test_loguru.py b/tests/integrations/loguru/test_loguru.py index 2db777d3c3..23f17e18f5 100644 --- a/tests/integrations/loguru/test_loguru.py +++ b/tests/integrations/loguru/test_loguru.py @@ -6,7 +6,7 @@ from loguru._recattrs import RecordFile, RecordLevel import sentry_sdk -from sentry_sdk.consts import VERSION +from sentry_sdk.consts import SPANDATA, VERSION from sentry_sdk.integrations.loguru import LoggingLevels, LoguruIntegration logger.remove(0) # don't print to console @@ -507,9 +507,9 @@ def test_logger_with_all_attributes( assert isinstance(attributes["sentry.release"], str) del attributes["sentry.release"] - assert "server.address" in attributes - assert isinstance(attributes["server.address"], str) - del attributes["server.address"] + assert SPANDATA.DEVICE_NAME in attributes + assert isinstance(attributes[SPANDATA.DEVICE_NAME], str) + del attributes[SPANDATA.DEVICE_NAME] assert "thread.id" in attributes assert isinstance(attributes["thread.id"], int) diff --git a/tests/integrations/socket/test_socket.py b/tests/integrations/socket/test_socket.py index 7578d954e6..d474ea475c 100644 --- a/tests/integrations/socket/test_socket.py +++ b/tests/integrations/socket/test_socket.py @@ -4,6 +4,7 @@ import sentry_sdk from sentry_sdk import start_transaction +from sentry_sdk.consts import SPANDATA from sentry_sdk.integrations.socket import SocketIntegration from tests.conftest import ApproxDict, create_mock_http_server @@ -30,7 +31,7 @@ def test_getaddrinfo_trace(sentry_init, capture_events, capture_items, span_stre assert dns_span["attributes"]["sentry.op"] == "socket.dns" assert dns_span["attributes"]["sentry.origin"] == "auto.socket.socket" assert dns_span["name"] == f"localhost:{PORT}" # noqa: E231 - assert dns_span["attributes"]["server.address"] == "localhost" + assert dns_span["attributes"][SPANDATA.DEVICE_NAME] == "localhost" assert dns_span["attributes"]["server.port"] == PORT else: events = capture_events() @@ -76,12 +77,12 @@ def test_create_connection_trace( assert connect_span["attributes"]["sentry.op"] == "socket.connection" assert connect_span["name"] == f"localhost:{PORT}" # noqa: E231 - assert connect_span["attributes"]["server.address"] == "localhost" + assert connect_span["attributes"][SPANDATA.DEVICE_NAME] == "localhost" assert connect_span["attributes"]["server.port"] == PORT assert dns_span["attributes"]["sentry.op"] == "socket.dns" assert dns_span["name"] == f"localhost:{PORT}" # noqa: E231 - assert dns_span["attributes"]["server.address"] == "localhost" + assert dns_span["attributes"][SPANDATA.DEVICE_NAME] == "localhost" assert dns_span["attributes"]["server.port"] == PORT else: events = capture_events() diff --git a/tests/test_logs.py b/tests/test_logs.py index e8a098ff44..3b34993e22 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -561,7 +561,7 @@ def test_transport_format(sentry_init, capture_envelopes): "type": "string", "value": "warn", }, - "server.address": { + SPANDATA.DEVICE_NAME: { "type": "string", "value": "test-server", }, @@ -647,7 +647,7 @@ def record_lost_event(reason, data_category=None, item=None, *, quantity=1): "type": "string", "value": "info", }, - "server.address": { + SPANDATA.DEVICE_NAME: { "type": "string", "value": "test-server", }, diff --git a/tests/test_metrics.py b/tests/test_metrics.py index e07e507ba7..0842480ac7 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -342,7 +342,7 @@ def test_transport_format(sentry_init, capture_envelopes): "type": "string", "value": VERSION, }, - "server.address": { + SPANDATA.DEVICE_NAME: { "type": "string", "value": "test-server", }, diff --git a/tests/test_transport.py b/tests/test_transport.py index 3db95c06f6..7b0ba73d56 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -10,6 +10,8 @@ import pytest +from sentry_sdk.consts import SPANDATA + try: import httpcore except (ImportError, ModuleNotFoundError): @@ -750,7 +752,7 @@ def test_complex_limits_without_data_category( "value": "info", "type": "string", }, - "server.address": { + SPANDATA.DEVICE_NAME: { "value": "test-server", "type": "string", }, @@ -780,7 +782,7 @@ def test_complex_limits_without_data_category( "value": "2.45.0", "type": "string", }, - "server.address": { + SPANDATA.DEVICE_NAME: { "value": "test-server", "type": "string", }, diff --git a/tests/tracing/test_decorator.py b/tests/tracing/test_decorator.py index 6c66afb6be..0e4046a250 100644 --- a/tests/tracing/test_decorator.py +++ b/tests/tracing/test_decorator.py @@ -4,7 +4,7 @@ import pytest import sentry_sdk -from sentry_sdk.consts import SPANTEMPLATE +from sentry_sdk.consts import SPANDATA, SPANTEMPLATE from sentry_sdk.tracing_utils import create_span_decorator from sentry_sdk.utils import logger from tests.conftest import patch_start_tracing_child @@ -449,7 +449,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -474,7 +474,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -505,7 +505,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -650,7 +650,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -676,7 +676,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -706,7 +706,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/tracing/test_span_streaming.py b/tests/tracing/test_span_streaming.py index 8aef2f7d17..6b3c826b3e 100644 --- a/tests/tracing/test_span_streaming.py +++ b/tests/tracing/test_span_streaming.py @@ -7,6 +7,7 @@ import pytest import sentry_sdk +from sentry_sdk.consts import SPANDATA from sentry_sdk.profiler.continuous_profiler import get_profiler_id from sentry_sdk.traces import ( NoOpStreamedSpan, @@ -1848,7 +1849,7 @@ def test_default_attributes(sentry_init, capture_envelopes): "sentry.segment.name": {"value": "test", "type": "string"}, "sentry.sdk.name": {"value": "sentry.python", "type": "string"}, "sentry.sdk.version": {"value": mock.ANY, "type": "string"}, - "server.address": {"value": "test-server", "type": "string"}, + SPANDATA.DEVICE_NAME: {"value": "test-server", "type": "string"}, "sentry.environment": {"value": "production", "type": "string"}, "sentry.platform": {"value": "python", "type": "string"}, "sentry.release": {"value": "1.0.0", "type": "string"}, From 057cd64ccac9346a067e84229e521b001dd56b14 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 14:58:53 +0200 Subject: [PATCH 3/8] Revert "fix tests" This reverts commit 757f878d61361504b74edcb30987e01cceef64d3. --- tests/integrations/aiomysql/test_aiomysql.py | 4 +- tests/integrations/asyncpg/test_asyncpg.py | 4 +- tests/integrations/boto3/test_s3.py | 4 +- .../test_clickhouse_driver.py | 161 +++++++++--------- tests/integrations/grpc/test_grpc.py | 8 +- tests/integrations/grpc/test_grpc_aio.py | 6 +- .../huggingface_hub/test_huggingface_hub.py | 14 +- tests/integrations/logging/test_logging.py | 8 +- tests/integrations/loguru/test_loguru.py | 8 +- tests/integrations/socket/test_socket.py | 7 +- tests/test_logs.py | 4 +- tests/test_metrics.py | 2 +- tests/test_transport.py | 6 +- tests/tracing/test_decorator.py | 14 +- tests/tracing/test_span_streaming.py | 3 +- 15 files changed, 124 insertions(+), 129 deletions(-) diff --git a/tests/integrations/aiomysql/test_aiomysql.py b/tests/integrations/aiomysql/test_aiomysql.py index deadbb6162..32f2a22538 100644 --- a/tests/integrations/aiomysql/test_aiomysql.py +++ b/tests/integrations/aiomysql/test_aiomysql.py @@ -47,7 +47,7 @@ def _get_db_name(): "db.name": MYSQL_DB, "db.system": "mysql", "db.user": MYSQL_USER, - SPANDATA.DEVICE_NAME: MYSQL_HOST, + "server.address": MYSQL_HOST, "server.port": MYSQL_PORT, } ), @@ -685,7 +685,7 @@ async def test_connection_pool(sentry_init, capture_events) -> None: assert len(connect_crumbs) >= pool_size # One connect span per pooled connection for crumb in connect_crumbs: assert crumb["data"]["db.system"] == "mysql" - assert crumb["data"][SPANDATA.DEVICE_NAME] == MYSQL_HOST + assert crumb["data"]["server.address"] == MYSQL_HOST @pytest.mark.asyncio diff --git a/tests/integrations/asyncpg/test_asyncpg.py b/tests/integrations/asyncpg/test_asyncpg.py index b9ee4d34a8..1991b9af05 100644 --- a/tests/integrations/asyncpg/test_asyncpg.py +++ b/tests/integrations/asyncpg/test_asyncpg.py @@ -51,7 +51,7 @@ def _get_db_name(): "db.system": "postgresql", "db.user": PG_USER, "db.driver.name": "asyncpg", - SPANDATA.DEVICE_NAME: PG_HOST, + "server.address": PG_HOST, "server.port": PG_PORT, } ), @@ -68,7 +68,7 @@ def _get_db_name(): "db.namespace": PG_NAME, "db.user": PG_USER, "db.driver.name": "asyncpg", - SPANDATA.DEVICE_NAME: PG_HOST, + "server.address": PG_HOST, "server.port": PG_PORT, } ), diff --git a/tests/integrations/boto3/test_s3.py b/tests/integrations/boto3/test_s3.py index 1f2c77f944..aeab5f58a1 100644 --- a/tests/integrations/boto3/test_s3.py +++ b/tests/integrations/boto3/test_s3.py @@ -125,7 +125,7 @@ def test_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -283,7 +283,7 @@ def test_omit_url_data_if_parsing_fails( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py index 4092107749..1cec232548 100644 --- a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py +++ b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py @@ -13,7 +13,6 @@ import sentry_sdk from sentry_sdk import capture_message, start_transaction -from sentry_sdk.consts import SPANDATA from sentry_sdk.integrations.clickhouse_driver import ClickhouseDriverIntegration from tests.conftest import ApproxDict @@ -50,7 +49,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -63,7 +62,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -76,7 +75,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -89,7 +88,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -102,7 +101,7 @@ def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -156,7 +155,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -169,7 +168,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -182,7 +181,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -195,7 +194,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -208,7 +207,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [[370]], "db.params": {"minv": 150}, @@ -259,7 +258,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -272,7 +271,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -285,7 +284,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -298,7 +297,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -311,7 +310,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [[370]], "db.params": {"minv": 150}, @@ -362,7 +361,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -374,7 +373,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -386,7 +385,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -398,7 +397,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -410,7 +409,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -462,7 +461,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -474,7 +473,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -486,7 +485,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -498,7 +497,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -510,7 +509,7 @@ def test_clickhouse_client_breadcrumbs_data_collection_overrides_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -561,7 +560,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -574,7 +573,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -587,7 +586,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -600,7 +599,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -613,7 +612,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_default( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [[370]], "db.params": {"minv": 150}, @@ -784,7 +783,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "DROP TABLE IF EXISTS test", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -800,7 +799,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -816,7 +815,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "INSERT INTO test (x) VALUES", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -832,7 +831,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "INSERT INTO test (x) VALUES", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -848,7 +847,7 @@ def test_clickhouse_client_spans( "sentry.op": "db", "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -905,7 +904,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -921,7 +920,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -937,7 +936,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -953,7 +952,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -969,7 +968,7 @@ def test_clickhouse_client_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1073,7 +1072,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "DROP TABLE IF EXISTS test", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "thread.id": mock.ANY, "thread.name": mock.ANY, @@ -1088,7 +1087,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "thread.id": mock.ANY, "thread.name": mock.ANY, @@ -1103,7 +1102,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "INSERT INTO test (x) VALUES", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "thread.id": mock.ANY, "thread.name": mock.ANY, @@ -1118,7 +1117,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "INSERT INTO test (x) VALUES", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1131,7 +1130,7 @@ def test_clickhouse_client_spans_with_pii( "db.namespace": "", "db.user": "default", "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1187,7 +1186,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -1203,7 +1202,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [], }, @@ -1219,7 +1218,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -1235,7 +1234,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -1251,7 +1250,7 @@ def test_clickhouse_client_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": {"minv": 150}, "db.result": [[370]], @@ -1305,7 +1304,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "DROP TABLE IF EXISTS test", @@ -1318,7 +1317,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", @@ -1331,7 +1330,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -1344,7 +1343,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "INSERT INTO test (x) VALUES", @@ -1357,7 +1356,7 @@ def test_clickhouse_dbapi_breadcrumbs(sentry_init, capture_events) -> None: "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "message": "SELECT sum(x) FROM test WHERE x > 150", @@ -1406,7 +1405,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1419,7 +1418,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1432,7 +1431,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -1445,7 +1444,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -1458,7 +1457,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": {"minv": 150}, "db.result": [[["370"]], [["'sum(x)'", "'Int64'"]]], @@ -1529,7 +1528,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "DROP TABLE IF EXISTS test", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1545,7 +1544,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1561,7 +1560,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1577,7 +1576,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1593,7 +1592,7 @@ def test_clickhouse_dbapi_spans( "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1650,7 +1649,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1666,7 +1665,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1682,7 +1681,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1698,7 +1697,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1714,7 +1713,7 @@ def test_clickhouse_dbapi_spans( "db.driver.name": "clickhouse-driver", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "same_process_as_parent": True, @@ -1788,7 +1787,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "DROP TABLE IF EXISTS test", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1803,7 +1802,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1818,7 +1817,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1833,7 +1832,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "INSERT INTO test (x) VALUES", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1848,7 +1847,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", "sentry.op": "db", "sentry.origin": "auto.db.clickhouse_driver", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, }, "trace_id": trace_id, @@ -1904,7 +1903,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1920,7 +1919,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.result": [[], []], }, @@ -1936,7 +1935,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [{"x": 100}], }, @@ -1952,7 +1951,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": [[170], [200]], }, @@ -1968,7 +1967,7 @@ def test_clickhouse_dbapi_spans_with_pii( "db.system": "clickhouse", "db.name": "", "db.user": "default", - SPANDATA.DEVICE_NAME: "localhost", + "server.address": "localhost", "server.port": 9000, "db.params": {"minv": 150}, "db.result": [[[370]], [["sum(x)", "Int64"]]], diff --git a/tests/integrations/grpc/test_grpc.py b/tests/integrations/grpc/test_grpc.py index 448e2d9c87..f50a2f62d1 100644 --- a/tests/integrations/grpc/test_grpc.py +++ b/tests/integrations/grpc/test_grpc.py @@ -8,7 +8,7 @@ import sentry_sdk from sentry_sdk import start_span, start_transaction -from sentry_sdk.consts import OP, SPANDATA +from sentry_sdk.consts import OP from sentry_sdk.integrations.grpc import GRPCIntegration from sentry_sdk.integrations.grpc.client import ClientInterceptor from sentry_sdk.tracing_utils import has_span_streaming_enabled @@ -316,7 +316,7 @@ def test_grpc_client_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", @@ -400,7 +400,7 @@ def test_grpc_client_unary_stream_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -494,7 +494,7 @@ def test_grpc_client_other_interceptor( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", diff --git a/tests/integrations/grpc/test_grpc_aio.py b/tests/integrations/grpc/test_grpc_aio.py index e7a8d0db0e..217dc110d2 100644 --- a/tests/integrations/grpc/test_grpc_aio.py +++ b/tests/integrations/grpc/test_grpc_aio.py @@ -8,7 +8,7 @@ import sentry_sdk from sentry_sdk import start_span, start_transaction -from sentry_sdk.consts import OP, SPANDATA +from sentry_sdk.consts import OP from sentry_sdk.integrations.grpc import GRPCIntegration from sentry_sdk.tracing_utils import has_span_streaming_enabled from tests.conftest import ApproxDict @@ -341,7 +341,7 @@ async def test_grpc_client_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", @@ -416,7 +416,7 @@ async def test_grpc_client_unary_stream_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/integrations/huggingface_hub/test_huggingface_hub.py b/tests/integrations/huggingface_hub/test_huggingface_hub.py index 13f3ce25fc..8d8e6a9b2e 100644 --- a/tests/integrations/huggingface_hub/test_huggingface_hub.py +++ b/tests/integrations/huggingface_hub/test_huggingface_hub.py @@ -532,7 +532,7 @@ def test_text_generation( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -671,7 +671,7 @@ def test_text_generation_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -814,7 +814,7 @@ def test_chat_completion( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -965,7 +965,7 @@ def test_chat_completion_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1114,7 +1114,7 @@ def test_chat_completion_api_error( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1315,7 +1315,7 @@ def test_chat_completion_with_tools( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1477,7 +1477,7 @@ def test_chat_completion_streaming_with_tools( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/integrations/logging/test_logging.py b/tests/integrations/logging/test_logging.py index 02ed6adcb0..661fc53f57 100644 --- a/tests/integrations/logging/test_logging.py +++ b/tests/integrations/logging/test_logging.py @@ -5,7 +5,7 @@ import pytest from sentry_sdk import get_client -from sentry_sdk.consts import SPANDATA, VERSION +from sentry_sdk.consts import VERSION from sentry_sdk.integrations.logging import ( LoggingIntegration, ignore_logger, @@ -572,9 +572,9 @@ def test_logger_with_all_attributes(sentry_init, capture_items): assert isinstance(attributes["sentry.release"], str) del attributes["sentry.release"] - assert SPANDATA.DEVICE_NAME in attributes - assert isinstance(attributes[SPANDATA.DEVICE_NAME], str) - del attributes[SPANDATA.DEVICE_NAME] + assert "server.address" in attributes + assert isinstance(attributes["server.address"], str) + del attributes["server.address"] assert "thread.id" in attributes assert isinstance(attributes["thread.id"], int) diff --git a/tests/integrations/loguru/test_loguru.py b/tests/integrations/loguru/test_loguru.py index 23f17e18f5..2db777d3c3 100644 --- a/tests/integrations/loguru/test_loguru.py +++ b/tests/integrations/loguru/test_loguru.py @@ -6,7 +6,7 @@ from loguru._recattrs import RecordFile, RecordLevel import sentry_sdk -from sentry_sdk.consts import SPANDATA, VERSION +from sentry_sdk.consts import VERSION from sentry_sdk.integrations.loguru import LoggingLevels, LoguruIntegration logger.remove(0) # don't print to console @@ -507,9 +507,9 @@ def test_logger_with_all_attributes( assert isinstance(attributes["sentry.release"], str) del attributes["sentry.release"] - assert SPANDATA.DEVICE_NAME in attributes - assert isinstance(attributes[SPANDATA.DEVICE_NAME], str) - del attributes[SPANDATA.DEVICE_NAME] + assert "server.address" in attributes + assert isinstance(attributes["server.address"], str) + del attributes["server.address"] assert "thread.id" in attributes assert isinstance(attributes["thread.id"], int) diff --git a/tests/integrations/socket/test_socket.py b/tests/integrations/socket/test_socket.py index d474ea475c..7578d954e6 100644 --- a/tests/integrations/socket/test_socket.py +++ b/tests/integrations/socket/test_socket.py @@ -4,7 +4,6 @@ import sentry_sdk from sentry_sdk import start_transaction -from sentry_sdk.consts import SPANDATA from sentry_sdk.integrations.socket import SocketIntegration from tests.conftest import ApproxDict, create_mock_http_server @@ -31,7 +30,7 @@ def test_getaddrinfo_trace(sentry_init, capture_events, capture_items, span_stre assert dns_span["attributes"]["sentry.op"] == "socket.dns" assert dns_span["attributes"]["sentry.origin"] == "auto.socket.socket" assert dns_span["name"] == f"localhost:{PORT}" # noqa: E231 - assert dns_span["attributes"][SPANDATA.DEVICE_NAME] == "localhost" + assert dns_span["attributes"]["server.address"] == "localhost" assert dns_span["attributes"]["server.port"] == PORT else: events = capture_events() @@ -77,12 +76,12 @@ def test_create_connection_trace( assert connect_span["attributes"]["sentry.op"] == "socket.connection" assert connect_span["name"] == f"localhost:{PORT}" # noqa: E231 - assert connect_span["attributes"][SPANDATA.DEVICE_NAME] == "localhost" + assert connect_span["attributes"]["server.address"] == "localhost" assert connect_span["attributes"]["server.port"] == PORT assert dns_span["attributes"]["sentry.op"] == "socket.dns" assert dns_span["name"] == f"localhost:{PORT}" # noqa: E231 - assert dns_span["attributes"][SPANDATA.DEVICE_NAME] == "localhost" + assert dns_span["attributes"]["server.address"] == "localhost" assert dns_span["attributes"]["server.port"] == PORT else: events = capture_events() diff --git a/tests/test_logs.py b/tests/test_logs.py index 3b34993e22..e8a098ff44 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -561,7 +561,7 @@ def test_transport_format(sentry_init, capture_envelopes): "type": "string", "value": "warn", }, - SPANDATA.DEVICE_NAME: { + "server.address": { "type": "string", "value": "test-server", }, @@ -647,7 +647,7 @@ def record_lost_event(reason, data_category=None, item=None, *, quantity=1): "type": "string", "value": "info", }, - SPANDATA.DEVICE_NAME: { + "server.address": { "type": "string", "value": "test-server", }, diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 0842480ac7..e07e507ba7 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -342,7 +342,7 @@ def test_transport_format(sentry_init, capture_envelopes): "type": "string", "value": VERSION, }, - SPANDATA.DEVICE_NAME: { + "server.address": { "type": "string", "value": "test-server", }, diff --git a/tests/test_transport.py b/tests/test_transport.py index 7b0ba73d56..3db95c06f6 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -10,8 +10,6 @@ import pytest -from sentry_sdk.consts import SPANDATA - try: import httpcore except (ImportError, ModuleNotFoundError): @@ -752,7 +750,7 @@ def test_complex_limits_without_data_category( "value": "info", "type": "string", }, - SPANDATA.DEVICE_NAME: { + "server.address": { "value": "test-server", "type": "string", }, @@ -782,7 +780,7 @@ def test_complex_limits_without_data_category( "value": "2.45.0", "type": "string", }, - SPANDATA.DEVICE_NAME: { + "server.address": { "value": "test-server", "type": "string", }, diff --git a/tests/tracing/test_decorator.py b/tests/tracing/test_decorator.py index 0e4046a250..6c66afb6be 100644 --- a/tests/tracing/test_decorator.py +++ b/tests/tracing/test_decorator.py @@ -4,7 +4,7 @@ import pytest import sentry_sdk -from sentry_sdk.consts import SPANDATA, SPANTEMPLATE +from sentry_sdk.consts import SPANTEMPLATE from sentry_sdk.tracing_utils import create_span_decorator from sentry_sdk.utils import logger from tests.conftest import patch_start_tracing_child @@ -449,7 +449,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -474,7 +474,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -505,7 +505,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -650,7 +650,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -676,7 +676,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -706,7 +706,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - SPANDATA.DEVICE_NAME: mock.ANY, + "server.address": mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/tracing/test_span_streaming.py b/tests/tracing/test_span_streaming.py index 6b3c826b3e..8aef2f7d17 100644 --- a/tests/tracing/test_span_streaming.py +++ b/tests/tracing/test_span_streaming.py @@ -7,7 +7,6 @@ import pytest import sentry_sdk -from sentry_sdk.consts import SPANDATA from sentry_sdk.profiler.continuous_profiler import get_profiler_id from sentry_sdk.traces import ( NoOpStreamedSpan, @@ -1849,7 +1848,7 @@ def test_default_attributes(sentry_init, capture_envelopes): "sentry.segment.name": {"value": "test", "type": "string"}, "sentry.sdk.name": {"value": "sentry.python", "type": "string"}, "sentry.sdk.version": {"value": mock.ANY, "type": "string"}, - SPANDATA.DEVICE_NAME: {"value": "test-server", "type": "string"}, + "server.address": {"value": "test-server", "type": "string"}, "sentry.environment": {"value": "production", "type": "string"}, "sentry.platform": {"value": "python", "type": "string"}, "sentry.release": {"value": "1.0.0", "type": "string"}, From 6878721c84574eea2da537cecb6823927ecbf880 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 15:04:53 +0200 Subject: [PATCH 4/8] stream_gen_ai_spans and boto3 tests --- sentry_sdk/client.py | 2 +- tests/integrations/boto3/test_s3.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sentry_sdk/client.py b/sentry_sdk/client.py index 8ec83e267e..83974fc5f8 100644 --- a/sentry_sdk/client.py +++ b/sentry_sdk/client.py @@ -232,7 +232,7 @@ def _serialized_v1_span_to_serialized_v2_span( if "environment" in event: attributes["sentry.environment"] = event["environment"] if "server_name" in event: - attributes["server.address"] = event["server_name"] + attributes[SPANDATA.DEVICE_NAME] = event["server_name"] if "transaction" in event: attributes["sentry.segment.name"] = event["transaction"] diff --git a/tests/integrations/boto3/test_s3.py b/tests/integrations/boto3/test_s3.py index aeab5f58a1..1f2c77f944 100644 --- a/tests/integrations/boto3/test_s3.py +++ b/tests/integrations/boto3/test_s3.py @@ -125,7 +125,7 @@ def test_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -283,7 +283,7 @@ def test_omit_url_data_if_parsing_fails( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } From d41855c728b908db2588a9c2e965d0b4a7c557f2 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 15:08:53 +0200 Subject: [PATCH 5/8] address logging and grpc test failures --- tests/integrations/grpc/test_grpc.py | 8 ++++---- tests/integrations/grpc/test_grpc_aio.py | 6 +++--- tests/integrations/logging/test_logging.py | 8 ++++---- tests/integrations/loguru/test_loguru.py | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/integrations/grpc/test_grpc.py b/tests/integrations/grpc/test_grpc.py index f50a2f62d1..448e2d9c87 100644 --- a/tests/integrations/grpc/test_grpc.py +++ b/tests/integrations/grpc/test_grpc.py @@ -8,7 +8,7 @@ import sentry_sdk from sentry_sdk import start_span, start_transaction -from sentry_sdk.consts import OP +from sentry_sdk.consts import OP, SPANDATA from sentry_sdk.integrations.grpc import GRPCIntegration from sentry_sdk.integrations.grpc.client import ClientInterceptor from sentry_sdk.tracing_utils import has_span_streaming_enabled @@ -316,7 +316,7 @@ def test_grpc_client_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", @@ -400,7 +400,7 @@ def test_grpc_client_unary_stream_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -494,7 +494,7 @@ def test_grpc_client_other_interceptor( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", diff --git a/tests/integrations/grpc/test_grpc_aio.py b/tests/integrations/grpc/test_grpc_aio.py index 217dc110d2..e7a8d0db0e 100644 --- a/tests/integrations/grpc/test_grpc_aio.py +++ b/tests/integrations/grpc/test_grpc_aio.py @@ -8,7 +8,7 @@ import sentry_sdk from sentry_sdk import start_span, start_transaction -from sentry_sdk.consts import OP +from sentry_sdk.consts import OP, SPANDATA from sentry_sdk.integrations.grpc import GRPCIntegration from sentry_sdk.tracing_utils import has_span_streaming_enabled from tests.conftest import ApproxDict @@ -341,7 +341,7 @@ async def test_grpc_client_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, "rpc.response.status_code": "OK", @@ -416,7 +416,7 @@ async def test_grpc_client_unary_stream_starts_span( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "custom parent", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/integrations/logging/test_logging.py b/tests/integrations/logging/test_logging.py index 661fc53f57..02ed6adcb0 100644 --- a/tests/integrations/logging/test_logging.py +++ b/tests/integrations/logging/test_logging.py @@ -5,7 +5,7 @@ import pytest from sentry_sdk import get_client -from sentry_sdk.consts import VERSION +from sentry_sdk.consts import SPANDATA, VERSION from sentry_sdk.integrations.logging import ( LoggingIntegration, ignore_logger, @@ -572,9 +572,9 @@ def test_logger_with_all_attributes(sentry_init, capture_items): assert isinstance(attributes["sentry.release"], str) del attributes["sentry.release"] - assert "server.address" in attributes - assert isinstance(attributes["server.address"], str) - del attributes["server.address"] + assert SPANDATA.DEVICE_NAME in attributes + assert isinstance(attributes[SPANDATA.DEVICE_NAME], str) + del attributes[SPANDATA.DEVICE_NAME] assert "thread.id" in attributes assert isinstance(attributes["thread.id"], int) diff --git a/tests/integrations/loguru/test_loguru.py b/tests/integrations/loguru/test_loguru.py index 2db777d3c3..23f17e18f5 100644 --- a/tests/integrations/loguru/test_loguru.py +++ b/tests/integrations/loguru/test_loguru.py @@ -6,7 +6,7 @@ from loguru._recattrs import RecordFile, RecordLevel import sentry_sdk -from sentry_sdk.consts import VERSION +from sentry_sdk.consts import SPANDATA, VERSION from sentry_sdk.integrations.loguru import LoggingLevels, LoguruIntegration logger.remove(0) # don't print to console @@ -507,9 +507,9 @@ def test_logger_with_all_attributes( assert isinstance(attributes["sentry.release"], str) del attributes["sentry.release"] - assert "server.address" in attributes - assert isinstance(attributes["server.address"], str) - del attributes["server.address"] + assert SPANDATA.DEVICE_NAME in attributes + assert isinstance(attributes[SPANDATA.DEVICE_NAME], str) + del attributes[SPANDATA.DEVICE_NAME] assert "thread.id" in attributes assert isinstance(attributes["thread.id"], int) From 795af592d32dd3c73279609b061a162c677d2508 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 15:17:56 +0200 Subject: [PATCH 6/8] fix common tests --- tests/test_logs.py | 4 ++-- tests/test_metrics.py | 2 +- tests/tracing/test_decorator.py | 14 +++++++------- tests/tracing/test_span_streaming.py | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/test_logs.py b/tests/test_logs.py index e8a098ff44..3b34993e22 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -561,7 +561,7 @@ def test_transport_format(sentry_init, capture_envelopes): "type": "string", "value": "warn", }, - "server.address": { + SPANDATA.DEVICE_NAME: { "type": "string", "value": "test-server", }, @@ -647,7 +647,7 @@ def record_lost_event(reason, data_category=None, item=None, *, quantity=1): "type": "string", "value": "info", }, - "server.address": { + SPANDATA.DEVICE_NAME: { "type": "string", "value": "test-server", }, diff --git a/tests/test_metrics.py b/tests/test_metrics.py index e07e507ba7..0842480ac7 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -342,7 +342,7 @@ def test_transport_format(sentry_init, capture_envelopes): "type": "string", "value": VERSION, }, - "server.address": { + SPANDATA.DEVICE_NAME: { "type": "string", "value": "test-server", }, diff --git a/tests/tracing/test_decorator.py b/tests/tracing/test_decorator.py index 6c66afb6be..0e4046a250 100644 --- a/tests/tracing/test_decorator.py +++ b/tests/tracing/test_decorator.py @@ -4,7 +4,7 @@ import pytest import sentry_sdk -from sentry_sdk.consts import SPANTEMPLATE +from sentry_sdk.consts import SPANDATA, SPANTEMPLATE from sentry_sdk.tracing_utils import create_span_decorator from sentry_sdk.utils import logger from tests.conftest import patch_start_tracing_child @@ -449,7 +449,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -474,7 +474,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -505,7 +505,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -650,7 +650,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -676,7 +676,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -706,7 +706,7 @@ def my_agent(): "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test-transaction", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } diff --git a/tests/tracing/test_span_streaming.py b/tests/tracing/test_span_streaming.py index 8aef2f7d17..6b3c826b3e 100644 --- a/tests/tracing/test_span_streaming.py +++ b/tests/tracing/test_span_streaming.py @@ -7,6 +7,7 @@ import pytest import sentry_sdk +from sentry_sdk.consts import SPANDATA from sentry_sdk.profiler.continuous_profiler import get_profiler_id from sentry_sdk.traces import ( NoOpStreamedSpan, @@ -1848,7 +1849,7 @@ def test_default_attributes(sentry_init, capture_envelopes): "sentry.segment.name": {"value": "test", "type": "string"}, "sentry.sdk.name": {"value": "sentry.python", "type": "string"}, "sentry.sdk.version": {"value": mock.ANY, "type": "string"}, - "server.address": {"value": "test-server", "type": "string"}, + SPANDATA.DEVICE_NAME: {"value": "test-server", "type": "string"}, "sentry.environment": {"value": "production", "type": "string"}, "sentry.platform": {"value": "python", "type": "string"}, "sentry.release": {"value": "1.0.0", "type": "string"}, From 0078610f0c39a5c5bf647de13d4a845e89e6ec93 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 15:21:44 +0200 Subject: [PATCH 7/8] huggingface_hub tests --- .../huggingface_hub/test_huggingface_hub.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integrations/huggingface_hub/test_huggingface_hub.py b/tests/integrations/huggingface_hub/test_huggingface_hub.py index 8d8e6a9b2e..13f3ce25fc 100644 --- a/tests/integrations/huggingface_hub/test_huggingface_hub.py +++ b/tests/integrations/huggingface_hub/test_huggingface_hub.py @@ -532,7 +532,7 @@ def test_text_generation( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -671,7 +671,7 @@ def test_text_generation_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -814,7 +814,7 @@ def test_chat_completion( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -965,7 +965,7 @@ def test_chat_completion_streaming( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1114,7 +1114,7 @@ def test_chat_completion_api_error( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1315,7 +1315,7 @@ def test_chat_completion_with_tools( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } @@ -1477,7 +1477,7 @@ def test_chat_completion_streaming_with_tools( "sentry.sdk.version": mock.ANY, "sentry.segment.id": mock.ANY, "sentry.segment.name": "test", - "server.address": mock.ANY, + SPANDATA.DEVICE_NAME: mock.ANY, "thread.id": mock.ANY, "thread.name": mock.ANY, } From f96c45c63dc147085bed25ad6a3df3600ac9ea2b Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 31 Aug 2026 15:35:30 +0200 Subject: [PATCH 8/8] logs and metrics tests --- tests/test_logs.py | 2 +- tests/test_metrics.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_logs.py b/tests/test_logs.py index 3b34993e22..6f54b44879 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -211,7 +211,7 @@ def test_logs_attributes(sentry_init, capture_items): if sentry_sdk.get_client().options.get("release") is not None: assert "sentry.release" in logs[0]["attributes"] assert logs[0]["attributes"]["sentry.message.parameter.my_var"] == "some value" - assert logs[0]["attributes"][SPANDATA.SERVER_ADDRESS] == "test-server" + assert logs[0]["attributes"][SPANDATA.DEVICE_NAME] == "test-server" assert logs[0]["attributes"]["sentry.sdk.name"].startswith("sentry.python") assert logs[0]["attributes"]["sentry.sdk.version"] == VERSION diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 0842480ac7..a906b65eef 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -89,7 +89,7 @@ def test_metrics_with_attributes(sentry_init, capture_items): assert metrics[0]["attributes"]["sentry.release"] == "1.0.0" assert metrics[0]["attributes"]["sentry.environment"] == "test" - assert metrics[0]["attributes"][SPANDATA.SERVER_ADDRESS] == "test-server" + assert metrics[0]["attributes"][SPANDATA.DEVICE_NAME] == "test-server" assert metrics[0]["attributes"]["sentry.sdk.name"].startswith("sentry.python") assert metrics[0]["attributes"]["sentry.sdk.version"] == VERSION