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

@Lms24Lms24 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'})

@Lms24Lms24 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 ownersJune 23, 2026 06:51
@Lms24
Lms24 requested review from JPeer264, andreiborza, chargome, logaretm, mydea and s1gr1d and removed request for a teamJune 23, 2026 06:51
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.47 kB--
@sentry/browser - with treeshaking flags25.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 flags74.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/react29.27 kB--
@sentry/react (incl. Tracing)48.28 kB--
@sentry/vue32.62 kB--
@sentry/vue (incl. Tracing)47.83 kB--
@sentry/svelte27.5 kB--
CDN Bundle29.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 - uncompressed88.95 kB+0.12%+104 B 🔺
CDN Bundle (incl. Tracing) - uncompressed145.02 kB+0.08%+104 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed93.65 kB+0.12%+104 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed148.99 kB+0.07%+104 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed218.47 kB+0.05%+104 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed263.89 kB+0.04%+104 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed267.85 kB+0.04%+104 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed277.58 kB+0.04%+104 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed281.53 kB+0.04%+104 B 🔺
@sentry/nextjs (client)50.67 kB--
@sentry/sveltekit (client)46.37 kB--
@sentry/core/server76.32 kB+0.04%+26 B 🔺
@sentry/core/browser63.48 kB+0.05%+31 B 🔺
@sentry/node-core61.63 kB--
@sentry/node123.61 kB--
@sentry/node/import (ESM hook with diagnostics-channel injection)69.95 kB--
@sentry/node/light50.55 kB--
@sentry/node - without tracing73.69 kB--
@sentry/aws-serverless84.89 kB--
@sentry/cloudflare (withSentry) - minified175.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?

@Lms24Lms24Jun 23, 2026

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.

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 developJun 23, 2026
284 checks passed
@Lms24
Lms24 deleted the lms/feat-core-setAttribute branch June 23, 2026 10:38
s1gr1d added a commit to getsentry/sentry-docs that referenced this pull request Jul 16, 2026
## DESCRIBE YOUR PR
Adds docs for "Attributes" (similar to the docs for "Tags") based on
those changelog entries:
-
[10.32.0](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#10320)
-
[10.33.0](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#10330)
And this PR: - getsentry/sentry-javascript#21705 (shipped
with 10.61.0)
Related to: getsentry/sentry-javascript#21218
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.

2 participants

@Lms24@JPeer264