Skip to content

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Nov 11, 2025

This PR adds scope.setAttribute, scope.setAttributes and scope.removeAttribute methods, as specified in our develop docs.

Right now, this PR only enables setting the attributes as well as the usual span data operations (clone(), update(), clear(), getSpanData()). These attributes are not yet applied to any of the telemetry we eventually want them to apply to. I'll take care of this in a follow-up PR.

closes #18140

ref https://linear.app/getsentry/project/implement-global-attributes-api-javascript-02c3c74184fc/issues

Copy link
Member Author

@Lms24 Lms24 Nov 11, 2025

Choose a reason for hiding this comment

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

In contrast to logs and metrics attribute definitions and helper functions, this one already handles array attributes. My thinking is, we introduce this here then unify logs, metrics (+ spans eventually) to use the types and APIs here. While we'll have to change the used types for logs and metrics, I don't think this is breaking as theoretically logs and metrics support subsets of the attribute value types specified here.

@Lms24 Lms24 force-pushed the lms/feat-core-scope-setAttributes branch from 3209923 to c94bcd6 Compare November 11, 2025 12:32
@Lms24 Lms24 self-assigned this Nov 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.84 kB +0.98% +241 B 🔺
@sentry/browser - with treeshaking flags 23.32 kB +1.04% +238 B 🔺
@sentry/browser (incl. Tracing) 41.47 kB +0.59% +241 B 🔺
@sentry/browser (incl. Tracing, Profiling) 45.75 kB +0.54% +244 B 🔺
@sentry/browser (incl. Tracing, Replay) 79.94 kB +0.32% +248 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.61 kB +0.34% +234 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 84.61 kB +0.27% +223 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 96.8 kB +0.25% +238 B 🔺
@sentry/browser (incl. Feedback) 41.51 kB +0.59% +241 B 🔺
@sentry/browser (incl. sendFeedback) 29.5 kB +0.83% +240 B 🔺
@sentry/browser (incl. FeedbackAsync) 34.43 kB +0.7% +238 B 🔺
@sentry/react 26.51 kB +0.89% +232 B 🔺
@sentry/react (incl. Tracing) 43.43 kB +0.58% +248 B 🔺
@sentry/vue 29.31 kB +0.81% +235 B 🔺
@sentry/vue (incl. Tracing) 43.24 kB +0.57% +241 B 🔺
@sentry/svelte 24.85 kB +0.99% +242 B 🔺
CDN Bundle 27.05 kB +0.61% +164 B 🔺
CDN Bundle (incl. Tracing) 42 kB +0.55% +226 B 🔺
CDN Bundle (incl. Tracing, Replay) 78.52 kB +0.29% +221 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 84 kB +0.28% +229 B 🔺
CDN Bundle - uncompressed 79.78 kB +1.21% +947 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 124.88 kB +0.77% +943 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 240.91 kB +0.4% +943 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 253.68 kB +0.38% +943 B 🔺
@sentry/nextjs (client) 45.57 kB +0.57% +257 B 🔺
@sentry/sveltekit (client) 41.85 kB +0.57% +236 B 🔺
@sentry/node-core 51 kB +0.47% +238 B 🔺
@sentry/node 158.08 kB +0.16% +240 B 🔺
@sentry/node - without tracing 92.87 kB +0.26% +234 B 🔺
@sentry/aws-serverless 106.64 kB +0.23% +238 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

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,460 - 9,170 +3%
GET With Sentry 1,423 15% 1,391 +2%
GET With Sentry (error only) 6,224 66% 6,178 +1%
POST Baseline 1,198 - 1,204 -0%
POST With Sentry 526 44% 528 -0%
POST With Sentry (error only) 1,050 88% 1,070 -2%
MYSQL Baseline 3,350 - 3,348 +0%
MYSQL With Sentry 501 15% 499 +0%
MYSQL With Sentry (error only) 2,751 82% 2,757 -0%

View base workflow run

@Lms24 Lms24 changed the title feat(core): Add Scope::setAttribute(s) APIs feat(core): Add scope attribute APIs Nov 11, 2025
@Lms24 Lms24 marked this pull request as ready for review November 11, 2025 16:04
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.

Add attribute APIs to Scope class

2 participants