From 18eb77fb01a78d334a90ede6c12edf75652cf63f Mon Sep 17 00:00:00 2001 From: Erica Pisani Date: Tue, 1 Sep 2026 15:20:31 -0400 Subject: [PATCH] feat(test-grpc): Migrate to streamed spans Under trace_lifecycle="stream", sentry_sdk.start_transaction() returns a NoOpSpan and records nothing. Replace the 3 live start_transaction calls (main.py, client.py, client-async.py) with sentry_sdk.traces.start_span(), which is the API that actually creates a real span under streaming. server.py and server-async.py had no start_transaction/start_span calls to convert; no @sentry_sdk.trace decorators were found in the project. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01TTtVSwfTGeB9RQzf3Pv8SE --- test-grpc/client-async.py | 3 ++- test-grpc/client.py | 3 ++- test-grpc/main.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test-grpc/client-async.py b/test-grpc/client-async.py index 9849c3b..a2802f6 100644 --- a/test-grpc/client-async.py +++ b/test-grpc/client-async.py @@ -6,6 +6,7 @@ import helloworld_pb2_grpc import sentry_sdk +import sentry_sdk.traces from sentry_sdk.integrations.grpc import GRPCIntegration # from sentry_sdk.integrations.grpc.client import ClientInterceptor from sentry_sdk.integrations.grpc.aio.client import ClientInterceptor @@ -28,7 +29,7 @@ async def main(): sentry_sdk.init(**sentry_settings) - with sentry_sdk.start_transaction(op="function", name="grcp_client"): + with sentry_sdk.traces.start_span(name="grcp_client", attributes={"sentry.op": "function"}): print("Will try to greet world ...") async with grpc.aio.insecure_channel(f"localhost:{SERVER_PORT}") as channel: diff --git a/test-grpc/client.py b/test-grpc/client.py index aa6f3f9..f69c7c9 100644 --- a/test-grpc/client.py +++ b/test-grpc/client.py @@ -5,6 +5,7 @@ import helloworld2_pb2_grpc import sentry_sdk +import sentry_sdk.traces from sentry_sdk.integrations.grpc import GRPCIntegration # from sentry_sdk.integrations.grpc.client import ClientInterceptor # from sentry_sdk.integrations.grpc.aio.client import ClientInterceptor @@ -27,7 +28,7 @@ def main(): sentry_sdk.init(**sentry_settings) - with sentry_sdk.start_transaction(op="function", name="grcp_client"): + with sentry_sdk.traces.start_span(name="grcp_client", attributes={"sentry.op": "function"}): print("Will try to greet world ...") with grpc.insecure_channel(f"localhost:{SERVER_PORT}") as channel: diff --git a/test-grpc/main.py b/test-grpc/main.py index e69e8d9..a07f08a 100644 --- a/test-grpc/main.py +++ b/test-grpc/main.py @@ -1,6 +1,7 @@ import os import sentry_sdk +import sentry_sdk.traces from sentry_sdk.integrations.clickhouse_driver import ClickhouseDriverIntegration from clickhouse_driver import Client @@ -19,7 +20,7 @@ def main(): sentry_sdk.init(**sentry_settings) - with sentry_sdk.start_transaction(op="function", name="clickhouse_driver"): + with sentry_sdk.traces.start_span(name="clickhouse_driver", attributes={"sentry.op": "function"}): client = Client(host='localhost', ) client.execute("DROP TABLE IF EXISTS test") client.execute("CREATE TABLE test (x Int32) ENGINE = Memory")