fix(spotlight): Add Sentry Spotlight dependency for debug builds#5667
fix(spotlight): Add Sentry Spotlight dependency for debug builds#5667
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. |
| compileOnly files('libs/replay-stubs.jar') | ||
| implementation 'com.facebook.react:react-native:+' | ||
| api 'io.sentry:sentry-android:8.32.0' | ||
| debugImplementation 'io.sentry:sentry-spotlight:8.32.0' |
There was a problem hiding this comment.
Bug: Using debugImplementation for the sentry-spotlight dependency in a library module will prevent it from being included in consuming apps, breaking the feature.
Severity: MEDIUM
Suggested Fix
To make the dependency available to consuming applications, change debugImplementation to api. To conditionally include it only for debug builds, this logic should be handled in the consuming application's build.gradle, not the library's. The library should provide the dependency transitively.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: packages/core/android/build.gradle#L59
Potential issue: The `sentry-spotlight` dependency is added using `debugImplementation`
in the `build.gradle` file of an Android library module. Dependencies added with
`debugImplementation` in a library are not transitive, meaning they are not passed on to
the application that consumes the library. Consequently, when a developer enables the
Spotlight feature in their app, the required `sentry-spotlight` classes will be missing
at runtime. This will cause the Spotlight feature to not function as intended for any
application using this SDK.
Did we get this right? 👍 / 👎 to inform future reviews.
|
I think the update dep release script needs to be updated as well otherwise it's gonna stay at 8.32.0 |
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f70acbf+dirty | 373.39 ms | 382.81 ms | 9.43 ms |
| d9f44bb+dirty | 400.64 ms | 431.65 ms | 31.01 ms |
| f3b058c+dirty | 501.18 ms | 536.70 ms | 35.52 ms |
| 8e653ac+dirty | 360.28 ms | 372.04 ms | 11.76 ms |
| eb07ba3 | 470.04 ms | 473.35 ms | 3.31 ms |
| 74979ac+dirty | 444.68 ms | 479.36 ms | 34.68 ms |
| 3bd3f0d+dirty | 447.21 ms | 472.31 ms | 25.10 ms |
| 785ffb1 | 471.92 ms | 460.96 ms | -10.96 ms |
| 6416d6c+dirty | 407.30 ms | 422.00 ms | 14.70 ms |
| ba75c7c | 367.72 ms | 369.16 ms | 1.44 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f70acbf+dirty | 17.75 MiB | 19.68 MiB | 1.94 MiB |
| d9f44bb+dirty | 43.75 MiB | 48.40 MiB | 4.64 MiB |
| f3b058c+dirty | 43.75 MiB | 48.07 MiB | 4.32 MiB |
| 8e653ac+dirty | 17.75 MiB | 19.75 MiB | 2.00 MiB |
| eb07ba3 | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| 74979ac+dirty | 43.75 MiB | 48.41 MiB | 4.66 MiB |
| 3bd3f0d+dirty | 17.75 MiB | 19.70 MiB | 1.95 MiB |
| 785ffb1 | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| 6416d6c+dirty | 43.75 MiB | 48.05 MiB | 4.30 MiB |
| ba75c7c | 17.75 MiB | 20.15 MiB | 2.41 MiB |
good point, will do on Monday! |
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9b50d32+dirty | 1216.53 ms | 1221.64 ms | 5.10 ms |
| 083f560+dirty | 1227.33 ms | 1242.02 ms | 14.69 ms |
| 7480abe+dirty | 1220.53 ms | 1244.18 ms | 23.65 ms |
| d1bfbde+dirty | 1216.83 ms | 1212.83 ms | -3.99 ms |
| a2bb688+dirty | 1223.53 ms | 1232.90 ms | 9.37 ms |
| 652f785+dirty | 1219.66 ms | 1223.62 ms | 3.96 ms |
| 6c36ba5+dirty | 1214.56 ms | 1216.52 ms | 1.96 ms |
| 9bf5446+dirty | 1206.20 ms | 1206.69 ms | 0.48 ms |
| f081f58+dirty | 1219.10 ms | 1217.57 ms | -1.53 ms |
| 0dff710+dirty | 1207.23 ms | 1203.26 ms | -3.97 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9b50d32+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| 083f560+dirty | 2.63 MiB | 4.00 MiB | 1.36 MiB |
| 7480abe+dirty | 2.63 MiB | 3.96 MiB | 1.33 MiB |
| d1bfbde+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| a2bb688+dirty | 2.63 MiB | 3.99 MiB | 1.36 MiB |
| 652f785+dirty | 3.41 MiB | 4.57 MiB | 1.16 MiB |
| 6c36ba5+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| 9bf5446+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| f081f58+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| 0dff710+dirty | 3.44 MiB | 4.59 MiB | 1.15 MiB |
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9b50d32+dirty | 1210.36 ms | 1218.41 ms | 8.05 ms |
| 083f560+dirty | 1215.27 ms | 1231.96 ms | 16.69 ms |
| 7480abe+dirty | 1219.84 ms | 1223.60 ms | 3.76 ms |
| d1bfbde+dirty | 1221.30 ms | 1218.70 ms | -2.60 ms |
| a2bb688+dirty | 1244.82 ms | 1238.60 ms | -6.22 ms |
| 652f785+dirty | 1216.42 ms | 1212.21 ms | -4.21 ms |
| 6c36ba5+dirty | 1208.55 ms | 1207.38 ms | -1.17 ms |
| 9bf5446+dirty | 1218.60 ms | 1210.45 ms | -8.15 ms |
| f081f58+dirty | 1208.37 ms | 1215.56 ms | 7.19 ms |
| 0dff710+dirty | 1194.90 ms | 1196.15 ms | 1.25 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9b50d32+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| 083f560+dirty | 3.19 MiB | 4.56 MiB | 1.38 MiB |
| 7480abe+dirty | 3.19 MiB | 4.53 MiB | 1.35 MiB |
| d1bfbde+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| a2bb688+dirty | 3.19 MiB | 4.56 MiB | 1.37 MiB |
| 652f785+dirty | 3.41 MiB | 4.57 MiB | 1.16 MiB |
| 6c36ba5+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| 9bf5446+dirty | 3.41 MiB | 4.59 MiB | 1.18 MiB |
| f081f58+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| 0dff710+dirty | 3.44 MiB | 4.59 MiB | 1.15 MiB |
|
I tested it locally and spotlight works just fine on debug, but also release? I thought it wasn't going to run in release |
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a206511+dirty | 331.54 ms | 356.98 ms | 25.44 ms |
| 8ff81c0+dirty | 392.47 ms | 431.52 ms | 39.05 ms |
| 170d5ea+dirty | 348.79 ms | 406.94 ms | 58.15 ms |
| bb4ea33+dirty | 360.73 ms | 375.02 ms | 14.29 ms |
| 80e4616+dirty | 427.31 ms | 461.15 ms | 33.84 ms |
| 9a81842+dirty | 508.08 ms | 566.65 ms | 58.56 ms |
| 64cd15c+dirty | 488.79 ms | 483.54 ms | -5.24 ms |
| 6bd9054+dirty | 376.24 ms | 407.76 ms | 31.52 ms |
| 73f2455+dirty | 369.33 ms | 398.90 ms | 29.57 ms |
| 23080e5+dirty | 347.29 ms | 381.87 ms | 34.58 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a206511+dirty | 43.94 MiB | 48.90 MiB | 4.96 MiB |
| 8ff81c0+dirty | 43.94 MiB | 48.87 MiB | 4.93 MiB |
| 170d5ea+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| bb4ea33+dirty | 43.94 MiB | 48.91 MiB | 4.97 MiB |
| 80e4616+dirty | 43.94 MiB | 49.38 MiB | 5.44 MiB |
| 9a81842+dirty | 43.94 MiB | 48.91 MiB | 4.97 MiB |
| 64cd15c+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| 6bd9054+dirty | 43.94 MiB | 48.90 MiB | 4.96 MiB |
| 73f2455+dirty | 43.94 MiB | 48.82 MiB | 4.88 MiB |
| 23080e5+dirty | 7.15 MiB | 8.41 MiB | 1.26 MiB |
|
@lucas-zimerman is it possible that the JS spotlight config is enabled as well? |
|
afaict envelopes go through both spotlight paths: js spotlight integration and native - prolly that's why you still see events coming through spotlight even though android is disabled could be an oversight in the impl |
📢 Type of change
📜 Description
Since 8.32.0 spotlight was separated into a different module, we now have to explicitly include it into the consuming project (when enabling spotlight in the Android SDK). The recommended way is to only do that for debug builds and not ship the artifact to production. See Flutter: https://github.com/getsentry/sentry-dart/blob/main/packages/flutter/android/build.gradle#L66
I haven't tested it, but afaik RN works in similar ways as Flutter, so the android project (from sentry-react-native) will be added as includedBuild locally to our customers' projects so this should suffice. But would be great if you can verify it on the sample app
💡 Motivation and Context
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled🔮 Next steps