Skip to content

feat(core): Emit sentry.sdk.integrations on segment spans in span streaming#20428

Draft
nicohrubec wants to merge 8 commits intodevelopfrom
nh/span-streaming-sdk-integrations
Draft

feat(core): Emit sentry.sdk.integrations on segment spans in span streaming#20428
nicohrubec wants to merge 8 commits intodevelopfrom
nh/span-streaming-sdk-integrations

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented Apr 21, 2026

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.

Relay's wire contract (AttributeType enum in relay-event-schema) defines
exactly five `type:` tags: boolean, integer, double, string, array.
The SDK's AttributeTypeMap previously declared typed array variants
(`string[]`, `integer[]`, etc.) that Relay does not recognize - these
were never actually emitted because the runtime serializer only handled
primitives, so array-valued attributes silently dropped.

This change:
- Collapses the four `x[]` variants in AttributeTypeMap into a single
  `array` variant whose value is `Array<string> | Array<number> | Array<boolean>`.
- Extends getTypedAttributeValue to auto-detect homogeneous primitive
  arrays and emit `{type: 'array', value: [...]}`.
- Adds an isHomogeneousPrimitiveArray guard so mixed-type and nested
  arrays remain unsupported (dropped by default, stringified under
  the fallback path).
- Updates tests to cover the new typed-array path (including empty
  arrays, unit preservation, and mixed-type drop/stringify).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.88 kB - -
@sentry/browser - with treeshaking flags 24.35 kB - -
@sentry/browser (incl. Tracing) 43.81 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 45.58 kB +0.18% +81 B 🔺
@sentry/browser (incl. Tracing, Profiling) 48.73 kB - -
@sentry/browser (incl. Tracing, Replay) 82.98 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 72.5 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 87.67 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 99.93 kB - -
@sentry/browser (incl. Feedback) 42.7 kB - -
@sentry/browser (incl. sendFeedback) 30.55 kB - -
@sentry/browser (incl. FeedbackAsync) 35.55 kB - -
@sentry/browser (incl. Metrics) 27.22 kB +0.22% +59 B 🔺
@sentry/browser (incl. Logs) 27.36 kB +0.28% +75 B 🔺
@sentry/browser (incl. Metrics & Logs) 28.04 kB +0.22% +60 B 🔺
@sentry/react 27.62 kB - -
@sentry/react (incl. Tracing) 46.05 kB - -
@sentry/vue 30.71 kB - -
@sentry/vue (incl. Tracing) 45.62 kB - -
@sentry/svelte 25.89 kB - -
CDN Bundle 28.63 kB +0.19% +54 B 🔺
CDN Bundle (incl. Tracing) 46.18 kB +0.22% +100 B 🔺
CDN Bundle (incl. Logs, Metrics) 30.01 kB +0.18% +53 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 47.23 kB +0.24% +112 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 68.97 kB +0.08% +51 B 🔺
CDN Bundle (incl. Tracing, Replay) 83.2 kB +0.08% +64 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 84.23 kB +0.09% +68 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 88.68 kB +0.09% +76 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 89.76 kB +0.08% +67 B 🔺
CDN Bundle - uncompressed 83.78 kB +0.23% +192 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 137.94 kB +0.24% +319 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 87.92 kB +0.22% +192 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 141.35 kB +0.23% +319 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 211.5 kB +0.1% +192 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 255.38 kB +0.13% +319 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 258.78 kB +0.13% +319 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 268.29 kB +0.12% +319 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 271.68 kB +0.12% +319 B 🔺
@sentry/nextjs (client) 48.58 kB - -
@sentry/sveltekit (client) 44.22 kB - -
@sentry/node-core 58.09 kB +0.14% +76 B 🔺
@sentry/node 174.99 kB +0.06% +101 B 🔺
@sentry/node - without tracing 98.08 kB +0.12% +117 B 🔺
@sentry/aws-serverless 115.3 kB +0.1% +111 B 🔺

View base workflow run

@nicohrubec nicohrubec changed the title Nh/span streaming sdk integrations feat(core): Emit sentry.sdk.integrations on segment spans in span streaming Apr 21, 2026
nicohrubec and others added 3 commits April 21, 2026 19:28
Arrays that were previously dropped by the serializer now ship as
native array attributes (`type: 'array'`). Update the affected
integration test expectations and bump size-limit thresholds for
the five bundle scenarios whose gzipped/uncompressed sizes grew
from the new serializer logic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the size-limit increases for the five bundle scenarios that grew
from adding homogeneous primitive array support. Test expectation
updates from the previous commit stay.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec force-pushed the nh/span-streaming-sdk-integrations branch from c34737a to 018435d Compare April 21, 2026 17:32
Re-apply the size-limit bumps needed to account for the new
homogeneous-primitive-array detection logic. Five scenarios grew
past their thresholds:

- @sentry/browser (incl. Metrics & Logs): 28 → 29 KB
- CDN Bundle (incl. Logs, Metrics): 30 → 31 KB
- CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed: 258.5 → 259 KB
- CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed: 268 → 269 KB
- CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed: 271.5 → 272 KB

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec force-pushed the nh/span-streaming-sdk-integrations branch from 825a63e to 018435d Compare April 21, 2026 18:15
…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>
@nicohrubec nicohrubec force-pushed the nh/span-streaming-sdk-integrations branch from 018435d to 8b38c1f Compare April 21, 2026 18:16
nicohrubec and others added 2 commits April 21, 2026 20:50
…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>
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