Skip to content

feat(spotlight): Share Local processing across server and UI - #1690

Draft
MathurAditya724 wants to merge 16 commits into
mainfrom
codex/shared-telemetry-package
Draft

MathurAditya724 wants to merge 16 commits into
mainfrom
codex/shared-telemetry-package

Conversation

@MathurAditya724

@MathurAditya724 MathurAditya724 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Sentry Local now uses @sentry/spotlight for shared envelope processing, trace assembly, queries, AI interpretation, profiles, and Web Vitals. The CLI receiver consumes the Node pipeline; the browser workspace consumes the portable store and processing helpers. HTTP/SSE transport, capture sessions, raw inspection, and rendering remain application concerns.

import { createTelemetryStore } from "@sentry/spotlight";
import { createTelemetryPipeline } from "@sentry/spotlight/node";

The Apache-2.0 package is extracted from Spotlight #1374 with bounded ingestion, immutable snapshots, delivery receipts, live retention settings, and JSON exports. Local preserves replay cursors, attachment downloads, session isolation, and existing inspection models.

Accepted delivery bytes remain stable across rejected redispatches and are replaced or cleared when an evicted ID is accepted again. Reset invalidates older cleanup work, and published views follow the retained capture window. Continuous profile chunks refresh merged samples and derived spans while preserving real topology; sample intervals are clipped at the next real span rather than dropped.

AI queries preserve root identity, prioritize structured conversations over prompt fallbacks, pair finish reasons with the surfaced response, ignore malformed token/tool-call attributes, and reconcile aggregate/step usage without double counting. Incomplete traces expose the strongest observed token subtotal. Local returns HTTP 415 for unsupported envelope media types, and direct CLI test commands build the SDK even when generated schema files are cached. Regression coverage exercises these paths through public readers and real receiver inputs, including reordered captures and concurrent session changes.

Toolkit becomes the home for shared processing. The release workflow builds and checks an independently versioned npm artifact. After the first package release, Spotlight can replace its extraction with this dependency and remove its local implementation; this PR does not publish a package.

Emitted declaration checks, executable examples, SDK tests, Local tests, workspace typechecking, and lint pass. The integration command also passes without prebuilt SDK output. The full local workspace run hits two unchanged macOS failures: the Linux-musl installer assertion and a DerivedData scan timeout. Hosted CI covers the Linux workspace and Local native integrations.

Extract the portable store, Node decoding pipeline, queries, and trace assembly into @sentry/telemetry. Use shared models in the Local receiver and browser workspace, and prepare independently versioned package releases.

Co-Authored-By: Codex <noreply@openai.com>
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sentry-local Ready Ready Preview Oct 29, 2026 2:59pm UTC

Request Review

Comment thread apps/local/src/lib/performance.ts
Comment thread apps/local/src/lib/telemetry-store.ts
Comment thread apps/local/src/lib/trace-model.ts
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts
Comment thread packages/telemetry/src/telemetry/data/profiles.ts Outdated
Comment thread packages/telemetry/src/telemetry/data/profiles.ts Outdated
Comment thread packages/spotlight/src/telemetry/data/profiles.ts
Comment thread packages/spotlight/src/telemetry/selectors/profiles.ts
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts
Publish the shared package as @sentry/spotlight and update workspace, consumer, and release paths. Preserve retained trace views, incomplete span summaries, AI metadata, and thread-aware profile processing with regression coverage.

Co-Authored-By: Codex <noreply@openai.com>
@MathurAditya724 MathurAditya724 changed the title feat(telemetry): Share Local processing across server and UI feat(spotlight): Share Local processing across server and UI Oct 28, 2026
Comment thread packages/spotlight/src/sdk/node.ts Outdated
Comment thread packages/spotlight/src/telemetry/ai/genAI.ts Outdated
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts Outdated
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts
Comment thread packages/spotlight/src/telemetry/data/profiles.ts Outdated
Comment thread packages/cli/src/commands/local/session-store.ts
Comment thread packages/spotlight/src/telemetry/data/profiles.ts
Co-Authored-By: Codex <noreply@openai.com>
Comment thread packages/spotlight/src/sdk/node.ts Outdated
Comment thread packages/spotlight/src/telemetry/ai/genAI.ts Outdated
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts Outdated
Comment thread apps/local/package.json Outdated
Merge main while preserving Local schema preparation and the CLI Sentry import.
Keep decoded history current when delivery IDs are reused, ignore invalid token
usage, and pair each surfaced response with its finish reason.

Co-Authored-By: Codex <noreply@openai.com>
Guard staged-byte cleanup by generation so cancelled parsed work cannot
remove a newly admitted delivery with the same ID after reset.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread packages/cli/src/commands/local/telemetry-buffer.ts Outdated
Comment thread packages/spotlight/src/telemetry/ai/genAI.ts
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts Outdated
Comment thread packages/spotlight/src/telemetry/data/profiles.test.ts Outdated
Comment thread packages/cli/package.json
Return 415 for unsupported envelope media types, preserve usable AI prompts
and tool calls, and clip profile intervals to the available gap. Build the
shared package for direct CLI test entry points even with cached schemas.

Co-Authored-By: Codex <noreply@openai.com>
Remove legacy subscriptions, disabled logging, unused private helpers and types, and unnecessary async test callbacks. Preserve the public API and executable examples.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread packages/cli/src/commands/local/telemetry-buffer.ts
Let the pipeline account for admitted writes and reserve facade slots only for writes deferred behind retention controls. Immediate validation failures no longer cause false queue-full responses.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread packages/spotlight/src/telemetry/ai/genAI.ts Outdated
Share message normalization between the GenAI and Vercel handlers.
Keep raw fallbacks replaceable until the first valid conversation is found.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread packages/spotlight/src/telemetry/ai/vercelAISDK.ts Outdated
Read standard tool-call attributes when the Vercel alias is absent or malformed.
Preserve valid proprietary values, including explicit empty arrays.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread packages/spotlight/src/telemetry/data/profiles.ts
Comment thread packages/spotlight/src/telemetry/envelope/codec.ts
MathurAditya724 and others added 2 commits October 29, 2026 17:21
Extend synthetic parent time ranges as later siblings are attached.
Avoid overlapping profile gaps while preserving real children and trailing samples.

Co-Authored-By: Codex <noreply@openai.com>
Classify known JSON wire items separately from processed event types.
Keep report fields available to subscribers and validate malformed payloads.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread apps/local/src/lib/trace-model.ts Outdated
Re-sort visible siblings after hiding missing-parent wrappers.
Preserve captured parent identifiers and keep the SDK span tree immutable.

Co-Authored-By: Codex <noreply@openai.com>
Comment thread packages/spotlight/src/telemetry/ai/inspection.ts Outdated
Comment thread packages/spotlight/src/telemetry/ai/inspection.ts Outdated
Comment thread packages/spotlight/src/telemetry/data/profiles.ts
Comment thread packages/spotlight/src/telemetry/ai/genAI.ts
MathurAditya724 and others added 2 commits October 29, 2026 19:35
Read nested system instructions and prefer structured conversations and
tool-call arrays over malformed aliases while retaining raw inspection values.
Treat null model and provider attributes as absent so later spans can supply
metadata.

Co-authored-by: Codex <noreply@openai.com>
Reparent merged children and lifted frames to their surviving parent spans.

Co-authored-by: Codex <noreply@openai.com>
Comment thread packages/spotlight/src/telemetry/data/profiles.ts
Use a neutral graft parent for fillers between independent trace roots.

Co-authored-by: Codex <noreply@openai.com>

This branch was successfully deployed

1 active deployment
Preview — c5b96e5f Deployed Oct 29, 2026 by vercel[bot]
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