-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(core): Ignore non-primitive values passed to setTag(s)
#18167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| this._tags = { ...this._tags, [key]: value }; | ||
| this._notifyScopeListeners(); | ||
| return this; | ||
| return this.setTags({ [key]: value }); |
There was a problem hiding this comment.
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
size-limit report 📦
|
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.
|
709a5e2 to
b56bece
Compare
andreiborza
left a comment
There was a problem hiding this 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?
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. 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 |
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