Skip to content

feat(tracing): Migrate to span streaming - #705

Open
sentrivana wants to merge 3 commits into
mainfrom
ivana/span-streaming
Open

sentrivana wants to merge 3 commits into
mainfrom
ivana/span-streaming

Conversation

@sentrivana

@sentrivana sentrivana commented Oct 22, 2026 •

Copy link
Copy Markdown

Enables span streaming (trace_lifecycle="stream") and moves all tracing to the sentry_sdk.traces API. In streaming mode the legacy transaction-based API (start_transaction, start_span, @sentry_sdk.trace, continue_trace) is a silent no-op, so every call site is migrated.

Note: taskbroker-client now only supports span streaming, so this brings launchpad up-to-date to allow installing newer taskbroker-client versions.

Changes

  • SDK init: trace_lifecycle="stream"; minimum sentry-sdk bumped to >=2.70.0.
  • Call sites: @sentry_sdk.trace → @sentry_sdk.traces.trace, start_span(op=X, description=Y) → traces.start_span(name=Y, attributes={"sentry.op": X}), set_data → set_attribute.
  • process_message: the transaction becomes a top-level span (parent_span=None). Streamed top-level spans inherit the scope's propagation context rather than generating a new trace ID like transactions did, so each task now runs in its own isolation_scope() with traces.new_trace(). Otherwise all tasks in a worker process would share one trace. Artifact IDs are set as tags (errors) and attributes (spans don't receive tags).
  • Apple binary-analysis workers: previously the parent rebuilt one span per binary from worker timestamps, since worker processes couldn't contribute to the parent's transaction. With streaming they send their own spans under the propagated trace, so _record_binary_span/_TimedBinary are removed. We now also get the workers' child spans (Mach-O parsing etc.). binary_name is set inside _analyze_binary, so it's also present for in-process analysis.

Testing

  • Replaced the span-reattachment integration test with one asserting worker _analyze_binary spans are streamed into the parent trace, descend from the parent-process span, and overlap in time.
  • Smoke-tested Android APK + iOS xcarchive analysis in stream mode with legacy-API warnings promoted to errors: none fired, 0 transactions, all spans streamed with expected ops/attributes, distinct trace per task.

Enable trace_lifecycle="stream" and move all tracing to the
sentry_sdk.traces API. The legacy transaction-based API is a no-op in
streaming mode.

- Replace @sentry_sdk.trace / start_span(op, description) / set_data
  with their streaming equivalents (sentry.op attribute, name,
  set_attribute).
- process_message starts a top-level span in a fresh isolation scope
  with new_trace(), so each task keeps its own trace. Artifact IDs are
  set as both tags (errors) and attributes (spans, logs).
- Binary-analysis worker processes now stream their own spans under the
  propagated parent trace, so the parent no longer rebuilds per-binary
  spans from worker timestamps.
@sentry

sentry Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Size Analysis

2 components analyzed

iOS Builds

Name Configuration Version Download Size Install Size
HackerNews (iOS)
com.emergetools.hackernews
Release 3.8 (1) 6.5 MB (N/A) 9.7 MB (N/A)

Android Builds

Name Configuration Version Download Size Uncompressed Size
Hacker News (Android)
com.emergetools.hackernews
Release 1.0.2 (13) 2.9 MB (N/A) 6.6 MB (N/A)

Configure launchpad-test-ios status check rules

@sentry

sentry Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
HackerNews com.emergetools.hackernews 3.8 (1) Release

Android

🔗 App Name App ID Version Configuration
Hacker News com.emergetools.hackernews 1.0.2 (13) Release

⚙️ launchpad-test-android Build Distribution Settings

ubuntu-latest now resolves to ubuntu-26.04, for which setup-python has
no 3.14.4 build. The Docker image mirror only carries 3.14.4, so pin the
runner until .python-version and the base images can be bumped together.
@sentrivana
sentrivana marked this pull request as ready for review October 22, 2026 12:49
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