Skip to content

feat(test-grpc): Migrate to streamed spans - #105

Merged
ericapisani merged 1 commit into
mainfrom
py-2758/test-grpc-span-api
Sep 1, 2026
Merged

ericapisani merged 1 commit into
mainfrom
py-2758/test-grpc-span-api

Conversation

@ericapisani

Copy link
Copy Markdown
Member

Summary

  • test-grpc already has trace_lifecycle="stream" (merged), under which sentry_sdk.start_transaction() and the top-level sentry_sdk.start_span() both return NoOpSpan and record nothing.
  • Replaced the 3 live start_transaction calls with sentry_sdk.traces.start_span(...), the API that creates a real span under streaming:
    • main.py: start_transaction(op="function", name="clickhouse_driver") → sentry_sdk.traces.start_span(name="clickhouse_driver", attributes={"sentry.op": "function"})
    • client.py: start_transaction(op="function", name="grcp_client") → sentry_sdk.traces.start_span(name="grcp_client", attributes={"sentry.op": "function"})
    • client-async.py: start_transaction(op="function", name="grcp_client") → sentry_sdk.traces.start_span(name="grcp_client", attributes={"sentry.op": "function"})
  • Added import sentry_sdk.traces to each edited file (not re-exported from sentry_sdk/__init__.py).
  • server.py and server-async.py were checked but contain no start_transaction/start_span calls — nothing to convert. No @sentry_sdk.trace decorators found anywhere in the project.
  • Preserved the deliberate error-raising behavior (TypeError("xyz!") in client.py, 1/0 in server-async.py) inside the traced blocks, unchanged.

Test plan

  • python -m py_compile on all 5 checked files (main.py, client.py, client-async.py, server.py, server-async.py)
  • grep -rn "start_transaction\|sentry_sdk.start_span" test-grpc returns no matches

🤖 Generated with Claude Code

https://claude.ai/code/session_01TTtVSwfTGeB9RQzf3Pv8SE

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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TTtVSwfTGeB9RQzf3Pv8SE
@linear-code

linear-code Bot commented Sep 1, 2026

Copy link
Copy Markdown

PY-2758

@ericapisani
ericapisani merged commit 4e03234 into main Sep 1, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant