Skip to content

feat(core): Add top-level Sentry.setAttribute(s) APIs#21705

Merged
Lms24 merged 2 commits into
developfrom
lms/feat-core-setAttribute
Jun 23, 2026
Merged

feat(core): Add top-level Sentry.setAttribute(s) APIs#21705
Lms24 merged 2 commits into
developfrom
lms/feat-core-setAttribute

Conversation

@Lms24

@Lms24 Lms24 commented Jun 23, 2026

Copy link
Copy Markdown
Member

Adds top-level Sentry.setAttribute(s) APIs, writing attributes to the isolation scope, analogously to Sentry.setTag(s). This was previously missing and should drastically simplify how users can set scope attributes.

Sentry.setAttribute('is_admin', true);
Sentry.setAttributes({
  'user.num_orders': user.numOrders
  'subscription.tier': 'pro'
})

@Lms24 Lms24 self-assigned this Jun 23, 2026
@Lms24 Lms24 marked this pull request as ready for review June 23, 2026 06:51
@Lms24 Lms24 requested review from a team as code owners June 23, 2026 06:51
@Lms24 Lms24 requested review from JPeer264, andreiborza, chargome, logaretm, mydea and s1gr1d and removed request for a team June 23, 2026 06:51
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.47 kB - -
@sentry/browser - with treeshaking flags 25.91 kB - -
@sentry/browser (incl. Tracing) 45.96 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.72 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.76 kB - -
@sentry/browser (incl. Tracing, Replay) 85.17 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.77 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.87 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.53 kB - -
@sentry/browser (incl. Feedback) 44.66 kB - -
@sentry/browser (incl. sendFeedback) 32.26 kB - -
@sentry/browser (incl. FeedbackAsync) 37.4 kB - -
@sentry/browser (incl. Metrics) 28.54 kB - -
@sentry/browser (incl. Logs) 28.78 kB - -
@sentry/browser (incl. Metrics & Logs) 29.47 kB - -
@sentry/react 29.27 kB - -
@sentry/react (incl. Tracing) 48.28 kB - -
@sentry/vue 32.62 kB - -
@sentry/vue (incl. Tracing) 47.83 kB - -
@sentry/svelte 27.5 kB - -
CDN Bundle 29.88 kB +0.07% +18 B 🔺
CDN Bundle (incl. Tracing) 47.9 kB +0.04% +17 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.44 kB +0.06% +18 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.24 kB +0.05% +22 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 70.74 kB +0.02% +14 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.26 kB +0.03% +20 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.53 kB +0.03% +19 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.1 kB +0.03% +19 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.36 kB +0.03% +19 B 🔺
CDN Bundle - uncompressed 88.95 kB +0.12% +104 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 145.02 kB +0.08% +104 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 93.65 kB +0.12% +104 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 148.99 kB +0.07% +104 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.47 kB +0.05% +104 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 263.89 kB +0.04% +104 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 267.85 kB +0.04% +104 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.58 kB +0.04% +104 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.53 kB +0.04% +104 B 🔺
@sentry/nextjs (client) 50.67 kB - -
@sentry/sveltekit (client) 46.37 kB - -
@sentry/core/server 76.32 kB +0.04% +26 B 🔺
@sentry/core/browser 63.48 kB +0.05% +31 B 🔺
@sentry/node-core 61.63 kB - -
@sentry/node 123.61 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.55 kB - -
@sentry/node - without tracing 73.69 kB - -
@sentry/aws-serverless 84.89 kB - -
@sentry/cloudflare (withSentry) - minified 175.71 kB - -
@sentry/cloudflare (withSentry) 437.11 kB -0.17% -730 B 🔽

View base workflow run

* scope.setAttributes({
* is_admin: true,
* payment_selection: 'credit_card',
* render_duration: { value: 'render_duration', unit: 'ms' },

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 that on purpose a number now?

@Lms24 Lms24 Jun 23, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, documentation was a bit off, since this was a string previously. Also, I opted to remove the unit documentation since the product doesn't yet show units

@Lms24 Lms24 merged commit f46ec47 into develop Jun 23, 2026
284 checks passed
@Lms24 Lms24 deleted the lms/feat-core-setAttribute branch June 23, 2026 10:38
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