Skip to content

feat(serverless): Add server-only context span attributes via processSegmentSpan hooks#20842

Open
chargome wants to merge 4 commits into
developfrom
cg-server-context-span-attributes
Open

feat(serverless): Add server-only context span attributes via processSegmentSpan hooks#20842
chargome wants to merge 4 commits into
developfrom
cg-server-context-span-attributes

Conversation

@chargome
Copy link
Copy Markdown
Member

@chargome chargome commented May 12, 2026

  • Converts server-only scope contexts to segment span attributes for span streaming, using processSegmentSpan hooks in their respective packages (so we avoid bundle size impact)
  • aws-serverless: Adds processSegmentSpan to awsLambdaIntegration for aws attributes
  • google-cloud-serverless: New gcpContextIntegration for gcp attributes

Server side part of #20828

closes #20385

@chargome chargome self-assigned this May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 26.88 kB - -
@sentry/browser - with treeshaking flags 25.32 kB - -
@sentry/browser (incl. Tracing) 44.78 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 46.75 kB - -
@sentry/browser (incl. Tracing, Profiling) 49.77 kB - -
@sentry/browser (incl. Tracing, Replay) 84.41 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 73.84 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.11 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 101.75 kB - -
@sentry/browser (incl. Feedback) 44.06 kB - -
@sentry/browser (incl. sendFeedback) 31.69 kB - -
@sentry/browser (incl. FeedbackAsync) 36.8 kB - -
@sentry/browser (incl. Metrics) 27.97 kB - -
@sentry/browser (incl. Logs) 28.11 kB - -
@sentry/browser (incl. Metrics & Logs) 28.8 kB - -
@sentry/react 28.63 kB - -
@sentry/react (incl. Tracing) 47.05 kB - -
@sentry/vue 31.8 kB - -
@sentry/vue (incl. Tracing) 46.65 kB - -
@sentry/svelte 26.9 kB - -
CDN Bundle 29.26 kB - -
CDN Bundle (incl. Tracing) 47.17 kB - -
CDN Bundle (incl. Logs, Metrics) 30.64 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.29 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 69.97 kB - -
CDN Bundle (incl. Tracing, Replay) 84.56 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 90.37 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 91.47 kB - -
CDN Bundle - uncompressed 86.08 kB - -
CDN Bundle (incl. Tracing) - uncompressed 141.53 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 90.28 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 145 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 215.1 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 260.24 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 263.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 273.94 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 277.38 kB - -
@sentry/nextjs (client) 49.56 kB - -
@sentry/sveltekit (client) 45.27 kB - -
@sentry/node-core 60.85 kB +0.02% +12 B 🔺
@sentry/node 165.98 kB +0.01% +10 B 🔺
@sentry/node - without tracing 73.97 kB +0.01% +7 B 🔺
@sentry/aws-serverless 108.24 kB +0.17% +176 B 🔺
@sentry/cloudflare (withSentry) - minified 170.68 kB - -
@sentry/cloudflare (withSentry) 430.48 kB - -

View base workflow run

@chargome
Copy link
Copy Markdown
Member Author

@cursor review

Comment thread packages/aws-serverless/src/integration/awslambda.ts Outdated
Comment thread packages/aws-serverless/test/awslambda-integration.test.ts
@chargome chargome changed the title feat(node,serverless): Add server-only context span attributes via processSegmentSpan hooks feat(serverless): Add server-only context span attributes via processSegmentSpan hooks May 13, 2026
@chargome
Copy link
Copy Markdown
Member Author

@cursor review

Copy link
Copy Markdown

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a2a432b. Configure here.

@chargome chargome marked this pull request as ready for review May 13, 2026 09:42
@chargome chargome requested a review from a team as a code owner May 13, 2026 09:42
@chargome chargome requested a review from nicohrubec May 13, 2026 09:45
Copy link
Copy Markdown
Member

@JPeer264 JPeer264 left a comment

Choose a reason for hiding this comment

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

LGTM. Just got some l's

Comment thread packages/aws-serverless/src/integration/awslambda.ts Outdated
Comment thread packages/aws-serverless/src/integration/awslambda.ts Outdated
Comment thread packages/google-cloud-serverless/src/integrations/gcp-context.ts Outdated
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec left a comment

Choose a reason for hiding this comment

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

nice

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.

Convert contexts set on scope to segment span attributes

3 participants