-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Unset tags #2218
Comments
Chiming in. As I read the code, you can't unset tags by passing See: https://github.com/getsentry/sentry-javascript/blob/master/packages/hub/src/scope.ts#L126 So a As it is, I'm stuck in how to clear the current set of tags from the scope. |
Do you know what happens if you do Is that tag being sent to Sentry and shown in there, even though it has |
@jtomaszewski |
Thanks for the answer. So it means I can unset tags by passing Could we update the TS definition for |
In TypeScript I am using |
@edzis You're right, we should fix the types. It doesn't solve the OP's problem entirely, but at least codifies that tags can be unset. I'm about to put up a PR. Will need to get some feedback from the rest of the team, but it seems a reasonable idea to me. |
One thing we'd like to have is the merged PR getsentry/sentry-javascript#3108, a type adjustment that lets us use `undefined` as a value in `setTag` and `setTags`. The author of that PR says that passing `undefined` for a tag's value is an unofficial way to unset a tag from the scope. If that works, we'd like to do it until getsentry/sentry-javascript#2218 is solved more officially. I see just one declared breaking change at 2.0.0 [1]: """ - build(android): Changes android package name from `io.sentry.RNSentryPackage` to `io.sentry.react.RNSentryPackage` (Breaking). zulip#1131 """ But autolinking handles the name change just fine, so there's nothing special we have to do about that. We don't have a complete libdef yet, but we seem to have good coverage for our usage in what we've translated from the TypeScript manually so far. So, double-check all of that against the new version and fix a few things that were slightly wrong or out-of-date (including by taking the relevant changes from getsentry/sentry-javascript#3108). [1] https://github.com/getsentry/sentry-react-native/blob/master/CHANGELOG.md#200
Closing the issue, as it seems like the original issue has been resolved. |
Tags can be set using scope.setTag and scope.setTags but there is only the ability to remove all tags with scope.clear. With SPA's where context changes greatly, it would be beneficial to be able to remove tags by tag name from the given scope
The text was updated successfully, but these errors were encountered: