-
-
Notifications
You must be signed in to change notification settings - Fork 357
Support for applying scope attributes to logs #5579
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
base: main
Are you sure you want to change the base?
Conversation
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Support for applying scope attributes to logs ([#5579](https://github.com/getsentry/sentry-react-native/pull/5579))If none of the above apply, you can opt out of this check by adding |
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 652f785+dirty | 401.02 ms | 420.60 ms | 19.58 ms |
| 20d5eaa | 377.62 ms | 406.50 ms | 28.88 ms |
| 3e0a5f9 | 401.72 ms | 394.98 ms | -6.74 ms |
| 0b64753+dirty | 448.67 ms | 474.61 ms | 25.94 ms |
| 90afdd3+dirty | 375.94 ms | 377.52 ms | 1.58 ms |
| d081295+dirty | 408.08 ms | 453.62 ms | 45.54 ms |
| 9a81842+dirty | 412.23 ms | 416.56 ms | 4.33 ms |
| 7480abe+dirty | 411.60 ms | 405.81 ms | -5.78 ms |
| 1853710 | 555.47 ms | 556.59 ms | 1.12 ms |
| 128ee72+dirty | 419.74 ms | 436.48 ms | 16.74 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 652f785+dirty | 43.75 MiB | 47.99 MiB | 4.24 MiB |
| 20d5eaa | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| 3e0a5f9 | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| 0b64753+dirty | 17.75 MiB | 19.70 MiB | 1.95 MiB |
| 90afdd3+dirty | 17.75 MiB | 19.70 MiB | 1.95 MiB |
| d081295+dirty | 43.75 MiB | 48.04 MiB | 4.29 MiB |
| 9a81842+dirty | 43.75 MiB | 48.08 MiB | 4.33 MiB |
| 7480abe+dirty | 17.75 MiB | 19.68 MiB | 1.94 MiB |
| 1853710 | 17.75 MiB | 19.68 MiB | 1.94 MiB |
| 128ee72+dirty | 43.75 MiB | 47.99 MiB | 4.24 MiB |
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0d6e618+dirty | 1226.16 ms | 1221.66 ms | -4.50 ms |
| 459a438+dirty | 1222.12 ms | 1214.60 ms | -7.53 ms |
| 170d5ea+dirty | 1219.27 ms | 1231.90 ms | 12.63 ms |
| a941c72+dirty | 1226.39 ms | 1223.60 ms | -2.78 ms |
| 294387d+dirty | 1197.73 ms | 1208.35 ms | 10.61 ms |
| 2104bb9+dirty | 1222.94 ms | 1221.16 ms | -1.77 ms |
| 5526494+dirty | 1224.73 ms | 1229.08 ms | 4.36 ms |
| 90afdd3+dirty | 1233.90 ms | 1240.90 ms | 7.00 ms |
| 6fee48d+dirty | 1222.14 ms | 1231.44 ms | 9.30 ms |
| 7be1f99+dirty | 1226.69 ms | 1217.76 ms | -8.93 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0d6e618+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| 459a438+dirty | 2.63 MiB | 3.98 MiB | 1.35 MiB |
| 170d5ea+dirty | 2.63 MiB | 3.98 MiB | 1.35 MiB |
| a941c72+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| 294387d+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| 2104bb9+dirty | 2.63 MiB | 4.00 MiB | 1.37 MiB |
| 5526494+dirty | 2.63 MiB | 3.87 MiB | 1.24 MiB |
| 90afdd3+dirty | 2.63 MiB | 3.99 MiB | 1.35 MiB |
| 6fee48d+dirty | 2.63 MiB | 3.96 MiB | 1.33 MiB |
| 7be1f99+dirty | 2.63 MiB | 3.81 MiB | 1.18 MiB |
|
@sentry review |
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0d6e618+dirty | 1191.59 ms | 1190.35 ms | -1.24 ms |
| 459a438+dirty | 1218.39 ms | 1226.14 ms | 7.75 ms |
| 170d5ea+dirty | 1233.96 ms | 1242.54 ms | 8.58 ms |
| a941c72+dirty | 1187.82 ms | 1192.13 ms | 4.30 ms |
| 294387d+dirty | 1199.23 ms | 1204.16 ms | 4.93 ms |
| 2104bb9+dirty | 1221.63 ms | 1214.73 ms | -6.91 ms |
| 5526494+dirty | 1217.06 ms | 1222.26 ms | 5.20 ms |
| 90afdd3+dirty | 1216.17 ms | 1225.55 ms | 9.38 ms |
| 6fee48d+dirty | 1208.85 ms | 1218.52 ms | 9.67 ms |
| 7be1f99+dirty | 1222.43 ms | 1217.15 ms | -5.28 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0d6e618+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| 459a438+dirty | 3.19 MiB | 4.55 MiB | 1.36 MiB |
| 170d5ea+dirty | 3.19 MiB | 4.55 MiB | 1.36 MiB |
| a941c72+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| 294387d+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| 2104bb9+dirty | 3.19 MiB | 4.57 MiB | 1.38 MiB |
| 5526494+dirty | 3.19 MiB | 4.44 MiB | 1.25 MiB |
| 90afdd3+dirty | 3.19 MiB | 4.55 MiB | 1.37 MiB |
| 6fee48d+dirty | 3.19 MiB | 4.53 MiB | 1.35 MiB |
| 7be1f99+dirty | 3.19 MiB | 4.38 MiB | 1.19 MiB |
|
The flaky Native Tests / ios should be fixed with #5577 🤞 |
antonis
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.
Thank you for this enhancement @alwx 🙇
The implementation looks solid and well-tested to me 👍
Please also add a changelog entry to communicate the feature enhancement.
q: Should we also sync the attributes to native? I guess we can handle this separately anyway if needed.
Let's also wait for @lucas-zimerman feedback before merging since he has a better understanding of the logs implementation.
|
@sentry review |
|
I am reviewing the code but i dont think the bot is working |
|
|
||
| // Apply scope attributes from all active scopes (global, isolation, and current) | ||
| // These are applied first so they can be overridden by more specific attributes | ||
| const scopeAttributes = collectScopeAttributes(); |
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.
could we try using
const {
user: { id, email, username },
attributes: scopeAttributes = {},
} = getCombinedScopeData(getIsolationScope(), currentScope);
I am not sure why Sentry JS Opted to only load data from isolationScope and currentScope, might be worth checking why.
📢 Type of change
📜 Description
Implements support for applying scope attributes to logs in the Sentry React Native SDK, aligning with the JavaScript SDK 10.32.0 (#5487).
Fixes #5488
Most of the changes actually come from JS SDK, this PR just exposes the required functions and does merging of scope attributes. I've also added tests for the changes to make sure the merging is being done correctly and that the scope attributes are being applied.
📝 Checklist
sendDefaultPIIis enabled🔮 Next steps