Skip to content

fix(tracing): Support streamed spans in Queries and traces - #1372

Merged
MathurAditya724 merged 1 commit into
mainfrom
codex/fix-streamed-query-spans
Oct 26, 2026
Merged

MathurAditya724 merged 1 commit into
mainfrom
codex/fix-streamed-query-spans

Conversation

@MathurAditya724

@MathurAditya724 MathurAditya724 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Spotlight ignored standalone span envelope items, so database queries sent by SDKs using the default streaming trace lifecycle were missing from Queries and trace details. Switching to traceLifecycle: "static" worked around the problem by sending transaction envelopes instead.

This change decodes v2 span containers and typed attributes into Spotlight's trace model. Queries appear as spans arrive, and the trace tree updates when parents arrive later. Segment metadata, span timing, and attributes are preserved across envelopes without duplicating spans. Legacy standalone spans and transaction envelopes remain supported.

@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
spotlightjs Skipped Skipped Oct 26, 2026 1:42am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ Patch coverage is 100.00% (45 of 45 changed executable lines covered; target 80%).
Project statement coverage is 55.49% (up 3.64 percentage points from base (e361ad4) to head (37a1135)).

Changed files with executable lines (4)
File Patch coverage Changed executable lines
packages/spotlight/src/ui/telemetry/store/utils/spanProcessor.ts 100.00% 29/29 covered; partial branches: 17, 40, 42, 84
packages/spotlight/src/ui/telemetry/store/slices/envelopesSlice.ts 100.00% 6/6 covered; partial branches: 85
packages/spotlight/src/ui/telemetry/store/slices/eventsSlice.ts 100.00% 4/4 covered; partial branches: 103
packages/spotlight/src/ui/telemetry/store/utils/traceProcessor.ts 100.00% 6/6 covered
Coverage diff
@@            Coverage Diff             @@
##          main     #1372       +/-##
==========================================
+ Coverage    51.85%    55.49%    +3.64%
==========================================
  Files           79        81        +2
  Tracked lines      2520      2586       +66
  Branches      1825      1889       +64
==========================================
+ Hits          1310      1439      +129
+ Misses        1210      1147       -63
- Partials       176       186       +10

Generated by Coverage Action

@MathurAditya724
MathurAditya724 marked this pull request as ready for review October 26, 2026 02:07
@MathurAditya724
MathurAditya724 merged commit a074a1b into main Oct 26, 2026
22 checks passed
@MathurAditya724
MathurAditya724 deleted the codex/fix-streamed-query-spans branch October 26, 2026 04:28
MathurAditya724 added a commit to getsentry/toolkit that referenced this pull request Oct 26, 2026
Local discovers capturing and saved sessions from a daemon's plain
loopback stream address. The searchable picker keeps feeds isolated,
refreshes as runs start or expire, and restores the selected capture
after reload. Local commands print a viewer link using the actual bound
port.

The viewer now supports investigation beyond raw payload inspection:

- **Capture controls:** session/project context, capture state,
connectivity, last received time and save deadline. Clear view, delete
captured events, stop capture and disconnect have distinct scopes.
Receiver switching probes the replacement before changing the feed;
failed attempts preserve the current capture. Onboarding provides a
copyable Local run command.
- **Errors and feedback:** exception causes, captured source context and
frame variables, breadcrumbs, request/context data, tags and modules.
Absolute local source paths have VS Code links, and Copy for AI produces
a Markdown summary. Modern feedback and legacy user reports link to
their associated captured error.
- **AI inspection:** standard GenAI and Vercel AI fields from embedded
and standalone spans show model/provider, token usage, system
instructions, messages, responses and tool arguments/results. Child AI
steps stay connected to the interaction. Spans identified only by
operation or origin remain visible when content was not captured.
- **Performance insights:** queries and resources group exact
operation/description pairs, sort by executions/duration/size, and open
individual executions in their trace. Web Vitals compares captured
measurements by page and visit, with explicit units and thresholds.
- **Profiles and diagnostics:** legacy profiles and continuous chunks
provide thread selection, inclusive/self function summaries, trace links
and interactive flame, treemap and sunburst views. Timing and
visualization limits are explicit. SDK inventory discovers
name/version/platform metadata independently of client reports.
Attachments preserve item headers and binary bytes, with
text/JSON/raster-image/video previews and downloads; captured HTML and
code remain inert. Download Blob URLs retain original MIME types only
for allowlisted raster/video media.
- **Investigation controls:** severity/logger facets, sorting and
configurable event metadata; trace search, only-matches, branch collapse
and adjustable tree width. Explicit event navigation reconciles active
facets. Session-wide Cmd/Ctrl+K search stays independent of the view
filter, resizable panes stack on narrow screens, and settings separates
appearance from capture history capacity.

For development, `pnpm --filter local sample` posts nine bundled,
sanitized example envelopes through the real receiver. It also replays a
custom file or recursive fixture directory, including Spotlight's
corpus, with endpoint selection, gzip/Brotli, intervals and repeated
passes. Byte-counted fixtures preserve their original bytes on Windows
checkouts. See the [viewer and replay
guide](https://github.com/getsentry/toolkit/blob/fbdbea3ec22b395de43c21910124e3ed68d55b0a/apps/local/README.md).

Discovery uses a separate capability restricted to loopback and trusted
hosted Local origins; it grants neither ingestion nor CLI control.
Scoped retention updates require the session stream capability. Hosted
viewers cannot delete receiver data or stop captures, and remote HTTPS
streams remain read-only. Older receivers connect without discovery;
restarting an older daemon to upgrade clears its in-memory telemetry.

The span-v2 handling from [Spotlight
#1372](getsentry/spotlight#1372) is adapted to
Toolkit's viewer model, including container validation, typed HTTP
attributes and late segment naming. Existing `/live` and `/sdks` routes
remain compatible, and original envelopes remain inspectable.

Validation: all 322 viewer tests pass, including HTTP/SSE replay,
analysis drill-down, binary attachments, filtered navigation, a
150,000-sample profile and Windows checkout regressions. Root typecheck
and lint pass. The Local workflow exercises viewer integration and
npm/native process E2E on Linux, macOS and Windows. The full local suite
still encounters the known macOS musl-installer and DerivedData-scan
failures; the unrelated issue-link cache race is unchanged.

The screenshots below show the capture/session flows:

| Location | Screenshot |
| --- | --- |
| Local › Capture onboarding | ![Capture-first
onboarding](https://github.com/user-attachments/assets/06ea9d44-09c5-458d-96f1-05c2fb7ff2c3)
|
| Local › Session picker, capturing and saved | ![Capturing and saved
session
picker](https://github.com/user-attachments/assets/1dd23262-3840-4cdb-bf58-3b3529ffeeff)
|
| Local › Events, request inspector | ![Request inspector and capture
context](https://github.com/user-attachments/assets/0da54608-63f7-4391-ab88-5712a912e4ae)
|
| Local › Logs, structured details | ![Structured log
inspection](https://github.com/user-attachments/assets/fc666fea-e461-437b-b828-9475110b88f5)
|
| Local › Traces, selected span | ![Selected span
inspector](https://github.com/user-attachments/assets/b0d6c91d-3315-4aa8-abe0-ccd4c508e0dc)
|
| Local › Traces, narrow viewport | ![Mobile trace
waterfall](https://github.com/user-attachments/assets/a7e74b58-a1d4-4e36-a1a9-12258967f553)
|
| Local › Saved capture, empty traces | ![Saved capture empty state and
deadline](https://github.com/user-attachments/assets/15a3ad4f-f3c7-477e-8f6b-2cc379c32d70)
|
| Local › Search this session, explicit view filter | ![Session search
with explicit view
filter](https://github.com/user-attachments/assets/14d5fa35-539f-4191-98c7-b1695879fc49)
|
| Local › Switch receiver | ![Switch receiver preserves the current
feed](https://github.com/user-attachments/assets/ca5e233b-1a3f-4e2c-9eac-2b21b2202eff)
|
| Local › Capture actions, delete confirmation | ![Confirmed deletion
scope on
mobile](https://github.com/user-attachments/assets/65dd81a1-7e20-42ba-b0f2-ae803b0bf0c5)
|
| Local › Settings, narrow viewport | ![Appearance and capture-scoped
capacity](https://github.com/user-attachments/assets/d6a0ebf2-edf3-4839-93a2-51744739ebb9)
|

---------

Co-authored-by: GPT-6 Codex <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 37a1135a Deployed Oct 26, 2026 by MathurAditya724 via Build #2440
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