diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index e90f63cbaf..61d5fe3cd7 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -18,6 +18,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh - A `Profile` object does not have a `.hub` property anymore. - `sentry_sdk.continue_trace` no longer returns a `Transaction` and is now a context manager. - Redis integration: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`). +- clickhouse-driver integration: The query is now available under the `db.query.text` span attribute (only if `send_default_pii` is `True`). ### Removed diff --git a/sentry_sdk/integrations/clickhouse_driver.py b/sentry_sdk/integrations/clickhouse_driver.py index daf4c2257c..4ee18d0e54 100644 --- a/sentry_sdk/integrations/clickhouse_driver.py +++ b/sentry_sdk/integrations/clickhouse_driver.py @@ -91,13 +91,15 @@ def _inner(*args: P.args, **kwargs: P.kwargs) -> T: _set_db_data(span, connection) - span.set_data("query", query) + if should_send_default_pii(): + span.set_attribute("db.query.text", query) if query_id: - span.set_data("db.query_id", query_id) + span.set_attribute("db.query_id", query_id) if params and should_send_default_pii(): - span.set_data("db.params", params) + connection._sentry_db_params = params + span.set_attribute("db.params", str(params)) # run the original code ret = f(*args, **kwargs) @@ -115,12 +117,26 @@ def _inner_end(*args: P.args, **kwargs: P.kwargs) -> T: if span is not None: if res is not None and should_send_default_pii(): - span.set_data("db.result", res) + span.set_attribute("db.result", str(res)) with capture_internal_exceptions(): - span.scope.add_breadcrumb( - message=span._data.pop("query"), category="query", data=span._data - ) + query = span.get_attribute("db.query.text") + if query: + data = {} + for attr in ( + "db.params", + "db.result", + SPANDATA.DB_SYSTEM, + SPANDATA.DB_USER, + SPANDATA.SERVER_ADDRESS, + SPANDATA.SERVER_PORT, + ): + if span.get_attribute(attr): + data[attr] = span.get_attribute(attr) + + sentry_sdk.add_breadcrumb( + message=query, category="query", data=data + ) span.finish() @@ -139,9 +155,15 @@ def _inner_send_data(*args: P.args, **kwargs: P.kwargs) -> T: _set_db_data(span, instance.connection) if should_send_default_pii(): - db_params = span._data.get("db.params", []) + db_params = ( + getattr(instance.connection, "_sentry_db_params", None) or [] + ) db_params.extend(data) - span.set_data("db.params", db_params) + span.set_attribute("db.params", str(db_params)) + try: + del instance.connection._sentry_db_params + except AttributeError: + pass return f(*args, **kwargs) @@ -151,8 +173,8 @@ def _inner_send_data(*args: P.args, **kwargs: P.kwargs) -> T: def _set_db_data( span: Span, connection: clickhouse_driver.connection.Connection ) -> None: - span.set_data(SPANDATA.DB_SYSTEM, "clickhouse") - span.set_data(SPANDATA.SERVER_ADDRESS, connection.host) - span.set_data(SPANDATA.SERVER_PORT, connection.port) - span.set_data(SPANDATA.DB_NAME, connection.database) - span.set_data(SPANDATA.DB_USER, connection.user) + span.set_attribute(SPANDATA.DB_SYSTEM, "clickhouse") + span.set_attribute(SPANDATA.SERVER_ADDRESS, connection.host) + span.set_attribute(SPANDATA.SERVER_PORT, connection.port) + span.set_attribute(SPANDATA.DB_NAME, connection.database) + span.set_attribute(SPANDATA.DB_USER, connection.user) diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 2e560ff3d7..42a1d4d7c9 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -1277,18 +1277,12 @@ def __exit__(self, ty, value, tb): # XXX set status to error if unset and an exception occurred? context.detach(self._ctx_token) - def _get_attribute(self, name): - # type: (str) -> Optional[Any] - if not isinstance(self._otel_span, ReadableSpan): - return None - return self._otel_span.attributes.get(name) - @property def description(self): # type: () -> Optional[str] from sentry_sdk.integrations.opentelemetry.consts import SentrySpanAttribute - return self._get_attribute(SentrySpanAttribute.DESCRIPTION) + return self.get_attribute(SentrySpanAttribute.DESCRIPTION) @description.setter def description(self, value): @@ -1303,7 +1297,7 @@ def origin(self): # type: () -> Optional[str] from sentry_sdk.integrations.opentelemetry.consts import SentrySpanAttribute - return self._get_attribute(SentrySpanAttribute.ORIGIN) + return self.get_attribute(SentrySpanAttribute.ORIGIN) @origin.setter def origin(self, value): @@ -1376,7 +1370,7 @@ def op(self): # type: () -> Optional[str] from sentry_sdk.integrations.opentelemetry.consts import SentrySpanAttribute - return self._get_attribute(SentrySpanAttribute.OP) + return self.get_attribute(SentrySpanAttribute.OP) @op.setter def op(self, value): @@ -1391,7 +1385,7 @@ def name(self): # type: () -> Optional[str] from sentry_sdk.integrations.opentelemetry.consts import SentrySpanAttribute - return self._get_attribute(SentrySpanAttribute.NAME) + return self.get_attribute(SentrySpanAttribute.NAME) @name.setter def name(self, value): @@ -1507,6 +1501,12 @@ def set_data(self, key, value): # TODO-neel-potel we cannot add dicts here self.set_attribute(key, value) + def get_attribute(self, name): + # type: (str) -> Optional[Any] + if not isinstance(self._otel_span, ReadableSpan): + return None + return self._otel_span.attributes.get(name) + def set_attribute(self, key, value): # type: (str, Any) -> None self._otel_span.set_attribute(key, value) diff --git a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py index 3b07a82f03..6378919b06 100644 --- a/tests/integrations/clickhouse_driver/test_clickhouse_driver.py +++ b/tests/integrations/clickhouse_driver/test_clickhouse_driver.py @@ -16,6 +16,8 @@ if clickhouse_driver.VERSION < (0, 2, 6): EXPECT_PARAMS_IN_SELECT = False +PARAMS_SERIALIZER = str + def test_clickhouse_client_breadcrumbs(sentry_init, capture_events) -> None: sentry_init( @@ -142,7 +144,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.result": [], + "db.result": str([]), }, "message": "DROP TABLE IF EXISTS test", "type": "default", @@ -155,7 +157,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.result": [], + "db.result": str([]), }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", "type": "default", @@ -168,7 +170,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.params": [{"x": 100}], + "db.params": PARAMS_SERIALIZER([{"x": 100}]), }, "message": "INSERT INTO test (x) VALUES", "type": "default", @@ -181,7 +183,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.params": [[170], [200]], + "db.params": PARAMS_SERIALIZER([[170], [200]]), }, "message": "INSERT INTO test (x) VALUES", "type": "default", @@ -194,8 +196,8 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) -> "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.result": [[370]], - "db.params": {"minv": 150}, + "db.result": str([[370]]), + "db.params": PARAMS_SERIALIZER({"minv": 150}), }, "message": "SELECT sum(x) FROM test WHERE x > 150", "type": "default", @@ -250,13 +252,15 @@ def test_clickhouse_client_spans( "origin": "auto.db.clickhouse_driver", "description": "DROP TABLE IF EXISTS test", "data": { + "sentry.name": "DROP TABLE IF EXISTS test", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -265,13 +269,15 @@ def test_clickhouse_client_spans( "origin": "auto.db.clickhouse_driver", "description": "CREATE TABLE test (x Int32) ENGINE = Memory", "data": { + "sentry.name": "CREATE TABLE test (x Int32) ENGINE = Memory", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -280,13 +286,15 @@ def test_clickhouse_client_spans( "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -295,13 +303,15 @@ def test_clickhouse_client_spans( "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -310,13 +320,15 @@ def test_clickhouse_client_spans( "origin": "auto.db.clickhouse_driver", "description": "SELECT sum(x) FROM test WHERE x > 150", "data": { + "sentry.name": "SELECT sum(x) FROM test WHERE x > 150", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -332,6 +344,8 @@ def test_clickhouse_client_spans( span.pop("span_id", None) span.pop("start_timestamp", None) span.pop("timestamp", None) + span.pop("same_process_as_parent", None) + span.pop("status", None) assert event["spans"] == expected_spans @@ -373,14 +387,17 @@ def test_clickhouse_client_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "DROP TABLE IF EXISTS test", "data": { + "sentry.name": "DROP TABLE IF EXISTS test", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.result": [], + "db.query.text": "DROP TABLE IF EXISTS test", + "db.result": str([]), }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -389,14 +406,17 @@ def test_clickhouse_client_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "CREATE TABLE test (x Int32) ENGINE = Memory", "data": { + "sentry.name": "CREATE TABLE test (x Int32) ENGINE = Memory", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", + "db.result": str([]), "server.address": "localhost", "server.port": 9000, - "db.result": [], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -405,14 +425,17 @@ def test_clickhouse_client_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "INSERT INTO test (x) VALUES", + "db.params": PARAMS_SERIALIZER([{"x": 100}]), "server.address": "localhost", "server.port": 9000, - "db.params": [{"x": 100}], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -421,14 +444,16 @@ def test_clickhouse_client_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "INSERT INTO test (x) VALUES", "server.address": "localhost", "server.port": 9000, - "db.params": [[170], [200]], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -437,15 +462,18 @@ def test_clickhouse_client_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "SELECT sum(x) FROM test WHERE x > 150", "data": { + "sentry.name": "SELECT sum(x) FROM test WHERE x > 150", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.params": PARAMS_SERIALIZER({"minv": 150}), + "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", + "db.result": str([(370,)]), "server.address": "localhost", "server.port": 9000, - "db.params": {"minv": 150}, - "db.result": [[370]], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -461,6 +489,8 @@ def test_clickhouse_client_spans_with_pii( span.pop("span_id", None) span.pop("start_timestamp", None) span.pop("timestamp", None) + span.pop("same_process_as_parent", None) + span.pop("status", None) assert event["spans"] == expected_spans @@ -592,7 +622,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.result": [[], []], + "db.result": str([[], []]), }, "message": "DROP TABLE IF EXISTS test", "type": "default", @@ -605,7 +635,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.result": [[], []], + "db.result": str([[], []]), }, "message": "CREATE TABLE test (x Int32) ENGINE = Memory", "type": "default", @@ -618,7 +648,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.params": [{"x": 100}], + "db.params": PARAMS_SERIALIZER([{"x": 100}]), }, "message": "INSERT INTO test (x) VALUES", "type": "default", @@ -631,7 +661,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.params": [[170], [200]], + "db.params": PARAMS_SERIALIZER([[170], [200]]), }, "message": "INSERT INTO test (x) VALUES", "type": "default", @@ -644,8 +674,8 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N "db.user": "default", "server.address": "localhost", "server.port": 9000, - "db.params": {"minv": 150}, - "db.result": [[["370"]], [["'sum(x)'", "'Int64'"]]], + "db.params": PARAMS_SERIALIZER({"minv": 150}), + "db.result": str([[["370"]], [["'sum(x)'", "'Int64'"]]]), }, "message": "SELECT sum(x) FROM test WHERE x > 150", "type": "default", @@ -698,13 +728,15 @@ def test_clickhouse_dbapi_spans(sentry_init, capture_events, capture_envelopes) "origin": "auto.db.clickhouse_driver", "description": "DROP TABLE IF EXISTS test", "data": { + "sentry.name": "DROP TABLE IF EXISTS test", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -713,13 +745,15 @@ def test_clickhouse_dbapi_spans(sentry_init, capture_events, capture_envelopes) "origin": "auto.db.clickhouse_driver", "description": "CREATE TABLE test (x Int32) ENGINE = Memory", "data": { + "sentry.name": "CREATE TABLE test (x Int32) ENGINE = Memory", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -728,13 +762,15 @@ def test_clickhouse_dbapi_spans(sentry_init, capture_events, capture_envelopes) "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -743,13 +779,15 @@ def test_clickhouse_dbapi_spans(sentry_init, capture_events, capture_envelopes) "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -758,13 +796,15 @@ def test_clickhouse_dbapi_spans(sentry_init, capture_events, capture_envelopes) "origin": "auto.db.clickhouse_driver", "description": "SELECT sum(x) FROM test WHERE x > 150", "data": { + "sentry.name": "SELECT sum(x) FROM test WHERE x > 150", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", "server.address": "localhost", "server.port": 9000, }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -780,6 +820,7 @@ def test_clickhouse_dbapi_spans(sentry_init, capture_events, capture_envelopes) span.pop("span_id", None) span.pop("start_timestamp", None) span.pop("timestamp", None) + span.pop("status") assert event["spans"] == expected_spans @@ -821,14 +862,17 @@ def test_clickhouse_dbapi_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "DROP TABLE IF EXISTS test", "data": { + "sentry.name": "DROP TABLE IF EXISTS test", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "DROP TABLE IF EXISTS test", + "db.result": str(([], [])), "server.address": "localhost", "server.port": 9000, - "db.result": [[], []], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -837,14 +881,17 @@ def test_clickhouse_dbapi_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "CREATE TABLE test (x Int32) ENGINE = Memory", "data": { + "sentry.name": "CREATE TABLE test (x Int32) ENGINE = Memory", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "CREATE TABLE test (x Int32) ENGINE = Memory", + "db.result": str(([], [])), "server.address": "localhost", "server.port": 9000, - "db.result": [[], []], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -853,14 +900,17 @@ def test_clickhouse_dbapi_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "INSERT INTO test (x) VALUES", + "db.params": PARAMS_SERIALIZER([{"x": 100}]), "server.address": "localhost", "server.port": 9000, - "db.params": [{"x": 100}], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -869,14 +919,17 @@ def test_clickhouse_dbapi_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "INSERT INTO test (x) VALUES", "data": { + "sentry.name": "INSERT INTO test (x) VALUES", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "INSERT INTO test (x) VALUES", + "db.params": PARAMS_SERIALIZER([[170], [200]]), "server.address": "localhost", "server.port": 9000, - "db.params": [[170], [200]], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -885,15 +938,18 @@ def test_clickhouse_dbapi_spans_with_pii( "origin": "auto.db.clickhouse_driver", "description": "SELECT sum(x) FROM test WHERE x > 150", "data": { + "sentry.name": "SELECT sum(x) FROM test WHERE x > 150", + "sentry.origin": "auto.db.clickhouse_driver", + "sentry.op": "db", "db.system": "clickhouse", "db.name": "", "db.user": "default", + "db.query.text": "SELECT sum(x) FROM test WHERE x > 150", + "db.params": PARAMS_SERIALIZER({"minv": 150}), + "db.result": str(([(370,)], [("sum(x)", "Int64")])), "server.address": "localhost", "server.port": 9000, - "db.params": {"minv": 150}, - "db.result": [[[370]], [["sum(x)", "Int64"]]], }, - "same_process_as_parent": True, "trace_id": transaction_trace_id, "parent_span_id": transaction_span_id, }, @@ -909,6 +965,8 @@ def test_clickhouse_dbapi_spans_with_pii( span.pop("span_id", None) span.pop("start_timestamp", None) span.pop("timestamp", None) + span.pop("same_process_as_parent", None) + span.pop("status", None) assert event["spans"] == expected_spans