Repository navigation
feat(sdk): Share portable telemetry processing across consumers - #1374
MathurAditya724 wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Coverage Results 📊✅ Patch coverage is 83.80% (1764 of 2105 changed executable lines covered; target 80%). Changed files with executable lines (53)
Coverage diff@@ Coverage Diff @@
## main #1374 +/-##
==========================================
+ Coverage 55.49% 73.02% +17.53%
==========================================
Files 81 118 +37
Tracked lines 2586 3603 +1017
Branches 1889 2801 +912
==========================================
+ Hits 1439 2656 +1217
+ Misses 1147 947 -200
- Partials 186 295 +109Generated by Coverage Action |
Use telemetry store and pipeline names, explicit envelope and payload batch methods, and decoded history options. Preserve live retention and immutable snapshots for deeply nested span graphs. Co-Authored-By: Codex <[email protected]>
Accept cross-realm byte inputs, preserve log-only traces and resource size metadata, and keep self-parented spans visible. Update the executable examples to the telemetry naming. Co-Authored-By: Codex <[email protected]>
Local now decodes and retains Sentry envelopes directly, removing `@spotlightjs/spotlight` from the CLI, viewer, and lockfile. The implementation stays inside the existing Local app and CLI; it does not introduce a reusable SDK or another package. Partial transaction and streamed-span updates merge by captured completion time, preserving names and fields across reordered deliveries. Query/resource summaries handle incomplete metadata, AI summaries combine captured steps, and continuous profile chunks can be inspected together. Trace waterfalls show observed sampled functions with their captured provenance; gaps and ambiguous parallel spans do not invent activity. The private receiver codec preserves binary attachments and malformed raw deliveries, validates byte lengths, and bounds encoded input, decompressed output, and pending admissions. Live delivery and session clear/resize/close ordering retain stable cursors and raw-download identities. Existing replay examples remain available. Spotlight-compatible health and envelope headers remain for existing Sentry SDK transports; the Spotlight npm dependency is removed. This replaces the shared-package approach in #1690 and getsentry/spotlight#1374 for Sentry Local. It does not migrate Spotlight itself onto Toolkit or expose the earlier proposals’ public SDK APIs. Co-Authored-By: Codex <[email protected]>
|
Closing this shared-SDK proposal because the chosen direction is direct implementation in Sentry Local: getsentry/toolkit#1940 is now squash-merged as Potential Spotlight-only follow-ups from this proposal remain recoverable at the pinned source commit; closing this PR does not claim these have landed in Spotlight: |
Spotlight's UI and SDK now share envelope normalization, trace assembly, logs, profiles, database/resource summaries, AI extraction, and web-vitals calculations. Server consumers get the same processing that powers the UI, including streamed spans from #1372. Moving the package to Toolkit remains separate work.
createTelemetryStore()from@spotlightjs/spotlight/sdk/coreaccepts parsed envelopes on the frontend or server.createTelemetryPipeline()from/sdk/nodeadds serialized payload decoding and bounded asynchronous decompression. The released/sdkbuffer helpers retain their existing behavior. Domain code moves out of the UI behind compatibility reexports, while the Node decoder no longer imports the Spotlight server.Both factories expose a shared
TelemetryReader, immutable snapshots, typed receipts, delivery IDs, ordered batches, cancellation, a drain barrier, and change notifications. Receipts distinguish processing from retention and include counts, a revision, and machine-readable diagnostics. Query/resource summaries are compact by default;includeSpans: trueretrieves detail. Reads support time/order/limit filters, and paged cursors are bound to the query and snapshot revision. Explicit versioned serializers preserve trace graphs, maps, and sets for JSON/tool consumers.The Node input methods are
ingestPayload()andgetDecodedPayload(); both factories also acceptingestEnvelope(). Pending ingestion, envelope bytes, retained history, decoded output, and enrichment time are bounded. The decompressor enforces its output limit before a compressed payload can expand without bounds. Parsed and payload writes share one Node admission queue, and cancellation during retention replay restores the previously committed history.Start review with the public contracts, core lifecycle, shared reader/serializers, and Node adapter. Retention defaults to 500 envelopes with a 64 MiB serialized-envelope budget. Eviction rebuilds derived state for correctness; immutable event/log/envelope copies and derived reads are reused, but large profiles still increase replay cost. The README documents exact limits, missing-record behavior, retry identity, lazy batch-copy semantics, JSON formats, and lifecycle behavior.
Regression coverage includes server/frontend/UI parity, binary/opaque items, malformed boundaries, compressed output limits, mixed-method admission and drain ordering, cancellation/reset during enrichment and eviction, byte retention, stale cursors, JSON graph references, and immutable UI reads. CI now checks the built public declarations and executes the server/frontend/React example contracts and lifecycle walkthrough after building.
The shared package and Sentry Local adoption are proposed in Toolkit #1690. After its first
@sentry/telemetryrelease, Spotlight can replace this extraction with the published dependency. Both PRs usecreateTelemetryStoreandcreateTelemetryPipeline; the Toolkit PR adds independently reusable Local inspection models.