加载中...
Skip to content

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Feb 3, 2026

This PR adds span JSON conversion and serialization helpers for span streaming:

  • spanToStreamedSpanJSON: Converts a Span instance to a JSON object used as intermediate representation as outlined in feat(core/spans): Add span v2 and envelope type definitions #19100
    • Adds SentrySpan::getStreamedSpanJSON method to convert our own spans
    • Directly converts any OTel spans
    • This is analogous to how spanToJSON works today.
  • spanJsonToSerializedSpan: Converts a StreamedSpanJSON into the final SerializedSpan to be sent to Sentry.

This PR also adds unit tests for both helpers.

ref #17836

This PR adds utilities for serializing spans to the new V2 format:

- `spanToV2JSON`: Converts a span to SerializedSpan (V2 format)
- `getV2SpanLinks`: Converts span links with serialized attributes
- `getV2StatusMessage`: Converts status to 'ok' | 'error'
- `INTERNAL_getSegmentSpan`: Renamed from getRootSpan (with alias kept)

These utilities are needed for the span streaming feature and will be
used by subsequent PRs to serialize spans before sending.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Lms24 Lms24 marked this pull request as draft February 3, 2026 14:54
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Codecov Results 📊


Generated by Codecov Action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.4 kB added added
@sentry/browser - with treeshaking flags 23.86 kB added added
@sentry/browser (incl. Tracing) 42.35 kB added added
@sentry/browser (incl. Tracing, Profiling) 46.99 kB added added
@sentry/browser (incl. Tracing, Replay) 81.02 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.58 kB added added
⛔️ @sentry/browser (incl. Tracing, Replay with Canvas) (max: 85.55 kB) 85.71 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 97.89 kB added added
@sentry/browser (incl. Feedback) 42.12 kB added added
@sentry/browser (incl. sendFeedback) 30.09 kB added added
@sentry/browser (incl. FeedbackAsync) 35.09 kB added added
@sentry/browser (incl. Metrics) 26.5 kB added added
@sentry/browser (incl. Logs) 26.65 kB added added
@sentry/browser (incl. Metrics & Logs) 27.32 kB added added
@sentry/react 27.13 kB added added
⛔️ @sentry/react (incl. Tracing) (max: 44.5 kB) 44.6 kB added added
@sentry/vue 29.98 kB added added
⛔️ @sentry/vue (incl. Tracing) (max: 44.1 kB) 44.16 kB added added
@sentry/svelte 25.41 kB added added
CDN Bundle 27.95 kB added added
⛔️ CDN Bundle (incl. Tracing) (max: 43 kB) 43.1 kB added added
CDN Bundle (incl. Logs, Metrics) 28.78 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 43.91 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 67.73 kB added added
CDN Bundle (incl. Tracing, Replay) 79.81 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 80.68 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 85.27 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.19 kB added added
CDN Bundle - uncompressed 81.74 kB added added
CDN Bundle (incl. Tracing) - uncompressed 127.71 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 84.57 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.54 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 207.95 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 244.31 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 247.13 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 257.11 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 259.92 kB added added
@sentry/nextjs (client) 46.94 kB added added
@sentry/sveltekit (client) 42.73 kB added added
@sentry/node-core 52.15 kB added added
@sentry/node 166.31 kB added added
@sentry/node - without tracing 93.91 kB added added
@sentry/aws-serverless 109.43 kB added added

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,324 - - added
GET With Sentry 1,675 18% - added
GET With Sentry (error only) 5,625 60% - added
POST Baseline 1,216 - - added
POST With Sentry 613 50% - added
POST With Sentry (error only) 1,072 88% - added
MYSQL Baseline 3,331 - - added
MYSQL With Sentry 545 16% - added
MYSQL With Sentry (error only) 2,758 83% - added

@Lms24 Lms24 self-assigned this Feb 3, 2026
@Lms24 Lms24 marked this pull request as ready for review February 3, 2026 15:47
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

});
});
});
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing integration or E2E test for feature PR

Low Severity

Per the review rules file, feat PRs should include at least one integration or E2E test. This PR only includes unit tests for the new spanToStreamedSpanJSON and spanJsonToSerializedSpan utilities. While the PR discussion mentions this is part of building blocks for a larger feature, consider adding integration tests to verify the serialization pipeline works end-to-end when the feature is complete.

Fix in Cursor Fix in Web

@Lms24 Lms24 changed the title feat(core): Span serialization utilities (spanToV2JSON) feat(core): Add span serialization utilities (spanToV2JSON) Feb 3, 2026
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.

2 participants