Skip to content

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Nov 11, 2025

Previously, the SDK would accept and send non-primitive tag values, despite this violating the tag specification as well as our documentation around the API. While the Sentry product can handle it (it displays the tag as invalid), I believe we should still avoid sending it in the first place. Especially because we also had a faulty test that asserted that non-primitive values were ignored.

closes #18163

@Lms24 Lms24 self-assigned this Nov 11, 2025
this._tags = { ...this._tags, [key]: value };
this._notifyScopeListeners();
return this;
return this.setTags({ [key]: value });
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.

small simplification here which reduces the bundle size hit from the additional check in setTags

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.62 kB +0.13% +30 B 🔺
@sentry/browser - with treeshaking flags 23.11 kB +0.13% +29 B 🔺
@sentry/browser (incl. Tracing) 41.26 kB +0.08% +29 B 🔺
@sentry/browser (incl. Tracing, Profiling) 45.53 kB +0.06% +27 B 🔺
@sentry/browser (incl. Tracing, Replay) 79.73 kB +0.04% +29 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.4 kB +0.04% +27 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 84.42 kB +0.04% +28 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 96.59 kB +0.03% +25 B 🔺
@sentry/browser (incl. Feedback) 41.3 kB +0.08% +29 B 🔺
@sentry/browser (incl. sendFeedback) 29.3 kB +0.11% +31 B 🔺
@sentry/browser (incl. FeedbackAsync) 34.22 kB +0.09% +30 B 🔺
@sentry/react 26.31 kB +0.12% +30 B 🔺
@sentry/react (incl. Tracing) 43.22 kB +0.07% +29 B 🔺
@sentry/vue 29.11 kB +0.11% +30 B 🔺
@sentry/vue (incl. Tracing) 43.03 kB +0.07% +29 B 🔺
@sentry/svelte 24.64 kB +0.14% +32 B 🔺
CDN Bundle 26.92 kB +0.11% +27 B 🔺
CDN Bundle (incl. Tracing) 41.8 kB +0.07% +27 B 🔺
CDN Bundle (incl. Tracing, Replay) 78.33 kB +0.04% +29 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 83.8 kB +0.04% +30 B 🔺
CDN Bundle - uncompressed 78.85 kB +0.02% +14 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 123.95 kB +0.02% +14 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 239.98 kB +0.01% +14 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 252.75 kB +0.01% +14 B 🔺
@sentry/nextjs (client) 45.34 kB +0.08% +32 B 🔺
@sentry/sveltekit (client) 41.64 kB +0.07% +29 B 🔺
@sentry/node-core 50.79 kB +0.06% +28 B 🔺
@sentry/node 157.87 kB +0.02% +27 B 🔺
@sentry/node - without tracing 92.66 kB +0.03% +23 B 🔺
@sentry/aws-serverless 106.44 kB +0.03% +28 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 8,695 - 9,170 -5%
GET With Sentry 1,332 15% 1,391 -4%
GET With Sentry (error only) 5,939 68% 6,178 -4%
POST Baseline 1,167 - 1,204 -3%
POST With Sentry 498 43% 528 -6%
POST With Sentry (error only) 1,051 90% 1,070 -2%
MYSQL Baseline 3,325 - 3,348 -1%
MYSQL With Sentry 452 14% 499 -9%
MYSQL With Sentry (error only) 2,714 82% 2,757 -2%

View base workflow run

@Lms24 Lms24 force-pushed the lms/fix-core-settag-non-primitive branch from 709a5e2 to b56bece Compare November 12, 2025 08:33
@Lms24 Lms24 requested review from a team, AbhiPrasad, RulaKhaled and andreiborza and removed request for a team and RulaKhaled November 12, 2025 08:44
@Lms24 Lms24 marked this pull request as ready for review November 12, 2025 08:45
Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

LGTM although if the product can handle it and nobody complained about this yet, I wonder if the bundle-size hit is even worth it. Are there any other concerns with this?

@Lms24
Copy link
Member Author

Lms24 commented Nov 12, 2025

LGTM although if the product can handle it and nobody complained about this yet, I wonder if the bundle-size hit is even worth it. Are there any other concerns with this?

That's a fair point. At least no-one complained about this yet, so we can also just leave things-as is. As written in the issue, typing-wise, we disallow non-primitives anyway. CDN bundle and plain JS users just likely don't get the type errors if they add anything else.
My thinking was that since we had a test that should have asserted that these values get dropped, this is a regression to fix.

I'll close this for now and follow up with a small PR to clarify the situation in the test and add that minimal bundle size improvement + tests to setTag

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.

SDK accepts and sends none-primitive values in setTag

3 participants