feat: added Get/Set Environment on Scope - #5772
Conversation
|
📲 Install BuildsAndroid
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 319.84 ms | 333.15 ms | 13.31 ms |
| c3ee041 | 310.64 ms | 361.90 ms | 51.26 ms |
| d501a7e | 348.06 ms | 431.42 ms | 83.36 ms |
| 3998a95 | 415.94 ms | 478.54 ms | 62.60 ms |
| ed33deb | 343.30 ms | 362.41 ms | 19.10 ms |
| 5b1a06b | 310.56 ms | 362.79 ms | 52.22 ms |
| 91bb874 | 310.68 ms | 359.24 ms | 48.56 ms |
| 0ee65e9 | 317.37 ms | 366.50 ms | 49.13 ms |
| 6edfca2 | 305.52 ms | 432.78 ms | 127.26 ms |
| 5e269de | 292.83 ms | 379.12 ms | 86.29 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 0 B | 0 B | 0 B |
| c3ee041 | 0 B | 0 B | 0 B |
| d501a7e | 0 B | 0 B | 0 B |
| 3998a95 | 1.58 MiB | 2.10 MiB | 532.96 KiB |
| ed33deb | 1.58 MiB | 2.13 MiB | 559.52 KiB |
| 5b1a06b | 0 B | 0 B | 0 B |
| 91bb874 | 1.58 MiB | 2.13 MiB | 559.07 KiB |
| 0ee65e9 | 0 B | 0 B | 0 B |
| 6edfca2 | 1.58 MiB | 2.13 MiB | 559.07 KiB |
| 5e269de | 0 B | 0 B | 0 B |
Previous results on branch: feat/scope-set-environment
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9f4de8c | 324.54 ms | 361.39 ms | 36.85 ms |
| 978ba7b | 315.02 ms | 355.28 ms | 40.26 ms |
| 62d5092 | 312.19 ms | 327.22 ms | 15.03 ms |
| 284a8f9 | 319.11 ms | 381.14 ms | 62.03 ms |
| e9c4258 | 339.22 ms | 436.33 ms | 97.10 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9f4de8c | 0 B | 0 B | 0 B |
| 978ba7b | 0 B | 0 B | 0 B |
| 62d5092 | 0 B | 0 B | 0 B |
| 284a8f9 | 0 B | 0 B | 0 B |
| e9c4258 | 0 B | 0 B | 0 B |
…nment # Conflicts: # sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java # sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt
| scopeCache.resetCache(); | ||
| final @Nullable String environment = globalScope.getEnvironment(); | ||
| if (environment != null) { | ||
| scopeCache.setEnvironment(environment); |
There was a problem hiding this comment.
l: can we maybe add a comment describing why we do this for environment now? Something like
// scope environment is configuration, not telemetry state: re-persist it after the reset like release/dist above
romtsn
left a comment
There was a problem hiding this comment.
overall looks good to me, nice job!
There's one place where I think we need to update the usage of environment too, and that is Baggage/DSC (Baggage.java:523, :560). That's the envelope header relay uses for dynamic-sampling rules and trace-level environment in the UI, so we should get it aligned with the rest of telemetry I believe?
Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3163e45. Configure here.
| ### Fixes | ||
|
|
||
| - Prevent concurrent PixelCopy access during Session Replay masking and bitmap cleanup ([#5808](https://github.com/getsentry/sentry-java/pull/5808)) | ||
| - Release `MediaMuxer` when the replay video encoder fails to start to avoid a resource leak ([#5607](https://github.com/getsentry/sentry-java/pull/5607)) |
There was a problem hiding this comment.
Duplicated changelog sections
Low Severity
The Unreleased notes now repeat ### Features, ### Improvements, and ### Fixes with the same entries. The feature line appears twice, and the existing improvements/fixes are duplicated instead of Features being moved above them.
Reviewed by Cursor Bugbot for commit 3163e45. Configure here.


📜 Description
Adds a getter and setter to the scope that allows users to configure the
Environmentat runtime.💡 Motivation and Context
See #5769
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps