You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the Scope only allows us to replace user data with the setUser() method, and because of this it's not possible to gradually include more specific user data. It would be good to merge that data.
Motivation
We don't always get all the user info from the same place, so it would be useful to gradually populate that data. For instance: adding the IP before the user is authenticated, then adding username and email afterwards.
Additional Context
The motivation for this request is the fact that the RequestListener from getsentry/sentry-symfony is overwriting my user data. As it does add some useful data, it would be best if it was possible to keep the user data it provided while also adding some data myself without replacing it.
The text was updated successfully, but these errors were encountered:
Indeed it makes sense and in fact the Unified API documentation says that the setUser method of the scope should do a shallow merge, so +1 on fixing this. How to do such change is another discussion unfortunately, as modifying the behavior of an existing function may break existing applications: adding a boolean argument defaulting to false that let users decide whether to replace the data as a whole or to merge existing data with the new one should be fine. Of course, we should throw a deprecation for the old behavior and then in 3.0 we will align with what other SDKs do out of the box. We should also add a removeUser method to let users remove information from the context, or we should clear all data if an empty array is passed (documentation talks about these two ways for solving this, but personally I find the first one the clearest). If this makes sense to you, are you willing to contribute the changes?
Summary
Currently the Scope only allows us to replace user data with the setUser() method, and because of this it's not possible to gradually include more specific user data. It would be good to merge that data.
Motivation
We don't always get all the user info from the same place, so it would be useful to gradually populate that data. For instance: adding the IP before the user is authenticated, then adding username and email afterwards.
Additional Context
The motivation for this request is the fact that the RequestListener from getsentry/sentry-symfony is overwriting my user data. As it does add some useful data, it would be best if it was possible to keep the user data it provided while also adding some data myself without replacing it.
The text was updated successfully, but these errors were encountered: