Skip to content

feat(core): Emit sentry.sdk.integrations on streamed segment spans - #20428

Merged
nicohrubec merged 7 commits into
developfrom
nh/span-streaming-sdk-integrations
May 13, 2026
Merged

feat(core): Emit sentry.sdk.integrations on streamed segment spans#20428
nicohrubec merged 7 commits into
developfrom
nh/span-streaming-sdk-integrations

Conversation

@nicohrubec

@nicohrubecnicohrubec commented Apr 21, 2026

Copy link
Copy Markdown
Member

In the classic (non-streaming) pipeline, SDK integrations are sets on the transaction event wrapper via event.sdk.integrations. In the streaming path this metadata is currently missing. This PR sets sentry.sdk.integrations on streamed segment spans.

@github-actions

github-actionsBot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser26.89 kB+0.05%+12 B 🔺
@sentry/browser - with treeshaking flags25.33 kB+0.05%+12 B 🔺
@sentry/browser (incl. Tracing)44.79 kB+0.03%+13 B 🔺
@sentry/browser (incl. Tracing + Span Streaming)46.8 kB+0.1%+46 B 🔺
@sentry/browser (incl. Tracing, Profiling)49.78 kB+0.03%+11 B 🔺
@sentry/browser (incl. Tracing, Replay)84.43 kB+0.02%+14 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags73.86 kB+0.02%+12 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)89.13 kB+0.02%+15 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)101.77 kB+0.02%+16 B 🔺
@sentry/browser (incl. Feedback)44.08 kB+0.04%+14 B 🔺
@sentry/browser (incl. sendFeedback)31.7 kB+0.04%+10 B 🔺
@sentry/browser (incl. FeedbackAsync)36.81 kB+0.04%+12 B 🔺
@sentry/browser (incl. Metrics)27.98 kB+0.05%+12 B 🔺
@sentry/browser (incl. Logs)28.13 kB+0.05%+12 B 🔺
@sentry/browser (incl. Metrics & Logs)28.8 kB+0.04%+9 B 🔺
@sentry/react28.64 kB+0.04%+9 B 🔺
@sentry/react (incl. Tracing)47.06 kB+0.03%+11 B 🔺
@sentry/vue31.82 kB+0.05%+14 B 🔺
@sentry/vue (incl. Tracing)46.67 kB+0.04%+14 B 🔺
@sentry/svelte26.91 kB+0.05%+12 B 🔺
CDN Bundle29.28 kB+0.06%+15 B 🔺
CDN Bundle (incl. Tracing)47.2 kB+0.07%+32 B 🔺
CDN Bundle (incl. Logs, Metrics)30.65 kB+0.04%+12 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics)48.34 kB+0.11%+52 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics)69.98 kB+0.02%+10 B 🔺
CDN Bundle (incl. Tracing, Replay)84.6 kB+0.05%+42 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)85.66 kB+0.05%+37 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)90.41 kB+0.05%+39 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)91.5 kB+0.05%+37 B 🔺
CDN Bundle - uncompressed86.14 kB+0.07%+55 B 🔺
CDN Bundle (incl. Tracing) - uncompressed141.7 kB+0.12%+163 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed90.33 kB+0.07%+55 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed145.16 kB+0.12%+163 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed215.16 kB+0.03%+55 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed260.41 kB+0.07%+163 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed263.85 kB+0.07%+163 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed274.11 kB+0.06%+163 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed277.54 kB+0.06%+163 B 🔺
@sentry/nextjs (client)49.57 kB+0.02%+8 B 🔺
@sentry/sveltekit (client)45.28 kB+0.03%+12 B 🔺
@sentry/node-core60.89 kB+0.09%+54 B 🔺
@sentry/node166.03 kB+0.04%+59 B 🔺
@sentry/node - without tracing74.02 kB+0.09%+63 B 🔺
@sentry/aws-serverless108.12 kB+0.05%+52 B 🔺
@sentry/cloudflare (withSentry) - minified170.88 kB+0.12%+203 B 🔺
@sentry/cloudflare (withSentry)431.1 kB+0.15%+620 B 🔺

View base workflow run

@nicohrubecnicohrubec changed the title Nh/span streaming sdk integrationsfeat(core): Emit sentry.sdk.integrations on segment spans in span streamingApr 21, 2026
@nicohrubec
nicohrubecforce-pushed the nh/span-streaming-sdk-integrations branch 5 times, most recently from db34ebc to ffe7af4CompareApril 28, 2026 11:56
@nicohrubec
nicohrubecforce-pushed the nh/span-streaming-sdk-integrations branch 3 times, most recently from b03ea96 to d394c8eCompareMay 13, 2026 07:16
nicohrubecand others added 4 commits May 13, 2026 09:48
…eaming
In the classic (non-streaming) pipeline, SDK integrations ride on the
transaction event wrapper via `event.sdk.integrations`. The span
streaming pipeline emits segment spans directly as span envelope items
with no transaction wrapper, so that metadata never reaches ingest.
Add `sentry.sdk.integrations` as a native array attribute on segment
spans (matching the wire contract Relay expects: `type: 'array'`).
Relies on the homogeneous-primitive-array serializer support.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ations
Segment spans now ship a sentry.sdk.integrations attribute listing the
active SDK integrations. Add the attribute to the full-shape assertions
in the browser unit test, the browser/node/cloudflare streamed
integration tests, and the Deno e2e test. Matching uses
expect.arrayContaining against the explicit integrations configured
in each scenario, to stay resilient to default-integration churn.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
oxfmt wants the SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS entries
broken across multiple lines because they exceed the max line length.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… expectation
Same fix applied to node-integration-tests earlier — the
node-core-integration-tests streamed basic-usage scenario also needs
sentry.sdk.integrations in its full-shape assertion.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nicohrubec
nicohrubecforce-pushed the nh/span-streaming-sdk-integrations branch from d394c8e to b8aa456CompareMay 13, 2026 07:49
@nicohrubecnicohrubec changed the title feat(core): Emit sentry.sdk.integrations on segment spans in span streamingfeat(core): Emit sentry.sdk.integrations on streamed segment spansMay 13, 2026
@nicohrubec
nicohrubec marked this pull request as ready for review May 13, 2026 08:00
@nicohrubec
nicohrubec requested review from a team as code ownersMay 13, 2026 08:00
@nicohrubec
nicohrubec requested a review from chargomeMay 13, 2026 08:05
}

function applySdkMetadataToSegmentSpan(segmentSpanJSON: StreamedSpanJSON, client: Client): void {
const integrationNames = client.getOptions().integrations.map(i => i.name);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

m: Do we need to call this on every capture? We could cache it maybe once?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

yep true that should work, changed it

@nicohrubec
nicohrubec requested a review from chargomeMay 13, 2026 09:17
Comment threadpackages/core/src/tracing/spans/captureSpan.ts Outdated
function applySdkMetadataToSegmentSpan(segmentSpanJSON: StreamedSpanJSON, client: Client): void {
let integrationNames = integrationNamesCache.get(client);
if (!integrationNames) {
integrationNames = client.getOptions().integrations.map(i => i.name);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

q: Is the order important here? E.g. if one has "InboundFilters", "BrowserTracing" and another has "BrowserTracing", "InboundFilters". Also should duplicates be removed (not that it happens, but you never know)?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I don't think it matters. This is also now directly aligned with how this has been implemented in the transaction path for the past 3 years so I'd assume we would have heard about this by now if it would be an issue

@cursorcursorBot left a comment

Copy link
Copy Markdown

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 585ce8c. Configure here.

Comment threadpackages/core/test/lib/tracing/spans/captureSpan.test.ts
…ns is populated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicohrubec
nicohrubec merged commit a544d2d into developMay 13, 2026
269 checks passed
@nicohrubec
nicohrubec deleted the nh/span-streaming-sdk-integrations branch May 13, 2026 11:20
Sign up for freeto 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.

3 participants

@nicohrubec@JPeer264@chargome