Skip to content

Conversation

@alwx
Copy link
Contributor

@alwx alwx commented Jan 26, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 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

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@alwx alwx self-assigned this Jan 26, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • Support for applying scope attributes to logs by alwx in #5579
  • chore(deps): bump actions/checkout from 6.0.1 to 6.0.2 by dependabot in #5576
  • chore(deps): bump github/codeql-action from 4.31.10 to 4.31.11 by dependabot in #5573
  • chore(deps): bump getsentry/craft from 2.19.0 to 2.20.0 by dependabot in #5575
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.19.0 to 2.20.0 by dependabot in #5574
  • ci(release): Fix changelog-preview permissions by BYK in #5571

🤖 This preview updates automatically when you update the PR.

@alwx alwx added the ready-to-merge Triggers the full CI test suite label Jan 26, 2026
@github-actions
Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

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 #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against fbc00cf

@alwx alwx marked this pull request as ready for review January 26, 2026 11:56
@github-actions
Copy link
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 590.94 ms 577.54 ms -13.40 ms
Size 43.75 MiB 48.40 MiB 4.64 MiB

Baseline results on branch: main

Startup times

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

@github-actions
Copy link
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1197.47 ms 1211.29 ms 13.82 ms
Size 3.38 MiB 4.60 MiB 1.22 MiB

Baseline results on branch: main

Startup times

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

@antonis
Copy link
Contributor

antonis commented Jan 26, 2026

@sentry review

@github-actions
Copy link
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1187.98 ms 1189.34 ms 1.36 ms
Size 3.38 MiB 4.60 MiB 1.22 MiB

Baseline results on branch: main

Startup times

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

@antonis
Copy link
Contributor

antonis commented Jan 26, 2026

The flaky Native Tests / ios should be fixed with #5577 🤞

Copy link
Contributor

@antonis antonis left a 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.

@lucas-zimerman
Copy link
Collaborator

@sentry review

@lucas-zimerman
Copy link
Collaborator

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();
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply Scope Attributes to Logs

4 participants