@sentry/react-native 7.10.0 → 8.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/RNSentry.podspec +8 -4
  2. package/android/libs/replay-stubs.jar +0 -0
  3. package/android/src/main/java/io/sentry/react/RNSentryCompositeOptionsConfiguration.java +25 -0
  4. package/android/src/main/java/io/sentry/react/RNSentryJsonConverter.java +76 -0
  5. package/android/src/main/java/io/sentry/react/RNSentryJsonUtils.java +41 -0
  6. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +22 -398
  7. package/android/src/main/java/io/sentry/react/RNSentrySDK.java +68 -0
  8. package/android/src/main/java/io/sentry/react/RNSentryStart.java +417 -0
  9. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  10. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
  11. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +15 -0
  12. package/dist/js/NativeRNSentry.d.ts +2 -0
  13. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  14. package/dist/js/NativeRNSentry.js.map +1 -1
  15. package/dist/js/integrations/logEnricherIntegration.js +43 -3
  16. package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
  17. package/dist/js/replay/mobilereplay.d.ts +0 -26
  18. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  19. package/dist/js/replay/mobilereplay.js.map +1 -1
  20. package/dist/js/scopeSync.d.ts.map +1 -1
  21. package/dist/js/scopeSync.js +21 -0
  22. package/dist/js/scopeSync.js.map +1 -1
  23. package/dist/js/sdk.d.ts.map +1 -1
  24. package/dist/js/sdk.js +21 -10
  25. package/dist/js/sdk.js.map +1 -1
  26. package/dist/js/tools/metroconfig.d.ts +9 -1
  27. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  28. package/dist/js/tools/metroconfig.js +9 -2
  29. package/dist/js/tools/metroconfig.js.map +1 -1
  30. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  31. package/dist/js/tools/sentryMetroSerializer.js +1 -0
  32. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  33. package/dist/js/tools/sentryOptionsSerializer.d.ts +6 -0
  34. package/dist/js/tools/sentryOptionsSerializer.d.ts.map +1 -0
  35. package/dist/js/tools/sentryOptionsSerializer.js +92 -0
  36. package/dist/js/tools/sentryOptionsSerializer.js.map +1 -0
  37. package/dist/js/tools/utils.d.ts +2 -1
  38. package/dist/js/tools/utils.d.ts.map +1 -1
  39. package/dist/js/tools/utils.js.map +1 -1
  40. package/dist/js/touchevents.d.ts +8 -0
  41. package/dist/js/touchevents.d.ts.map +1 -1
  42. package/dist/js/touchevents.js +33 -1
  43. package/dist/js/touchevents.js.map +1 -1
  44. package/dist/js/utils/worldwide.d.ts +2 -0
  45. package/dist/js/utils/worldwide.d.ts.map +1 -1
  46. package/dist/js/utils/worldwide.js.map +1 -1
  47. package/dist/js/version.d.ts +1 -1
  48. package/dist/js/version.d.ts.map +1 -1
  49. package/dist/js/version.js +1 -1
  50. package/dist/js/version.js.map +1 -1
  51. package/dist/js/wrapper.d.ts +2 -0
  52. package/dist/js/wrapper.d.ts.map +1 -1
  53. package/dist/js/wrapper.js +32 -0
  54. package/dist/js/wrapper.js.map +1 -1
  55. package/ios/RNSentry.h +3 -0
  56. package/ios/RNSentry.mm +28 -44
  57. package/ios/RNSentryDependencyContainer.h +2 -1
  58. package/ios/RNSentryDependencyContainer.m +1 -0
  59. package/ios/RNSentryEmitNewFrameEvent.h +3 -0
  60. package/ios/RNSentryExperimentalOptions.m +1 -1
  61. package/ios/RNSentryFramesTrackerListener.h +2 -2
  62. package/ios/RNSentryFramesTrackerListener.m +2 -0
  63. package/ios/RNSentryOnDrawReporter.h +2 -1
  64. package/ios/RNSentryOnDrawReporter.m +2 -0
  65. package/ios/RNSentryRNSScreen.m +3 -4
  66. package/ios/RNSentryReplay.mm +0 -5
  67. package/ios/RNSentryReplayBreadcrumbConverter.m +12 -12
  68. package/ios/RNSentrySDK.h +31 -0
  69. package/ios/RNSentrySDK.m +78 -0
  70. package/ios/RNSentryStart.h +25 -0
  71. package/ios/RNSentryStart.m +228 -0
  72. package/ios/RNSentryVersion.m +1 -1
  73. package/ios/SentryScreenFramesWrapper.h +14 -0
  74. package/ios/SentryScreenFramesWrapper.m +39 -0
  75. package/package.json +10 -10
  76. package/plugin/build/logger.d.ts +24 -0
  77. package/plugin/build/logger.js +44 -0
  78. package/plugin/build/utils.d.ts +0 -18
  79. package/plugin/build/utils.js +1 -34
  80. package/plugin/build/version.d.ts +2 -0
  81. package/plugin/build/version.js +6 -0
  82. package/plugin/build/withSentry.d.ts +1 -0
  83. package/plugin/build/withSentry.js +11 -10
  84. package/plugin/build/withSentryAndroid.d.ts +6 -1
  85. package/plugin/build/withSentryAndroid.js +52 -8
  86. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
  87. package/plugin/build/withSentryAndroidGradlePlugin.js +8 -8
  88. package/plugin/build/withSentryIOS.d.ts +6 -1
  89. package/plugin/build/withSentryIOS.js +55 -7
  90. package/scripts/sentry-xcode.sh +20 -0
  91. package/sentry.gradle +51 -0
  92. package/src/js/NativeRNSentry.ts +2 -0
  93. package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
  94. package/ts3.8/dist/js/replay/mobilereplay.d.ts +0 -26
  95. package/ts3.8/dist/js/touchevents.d.ts +8 -0
  96. package/ts3.8/dist/js/utils/worldwide.d.ts +2 -0
  97. package/ts3.8/dist/js/version.d.ts +1 -1
  98. package/ts3.8/dist/js/wrapper.d.ts +2 -0
@@ -0,0 +1,68 @@
1
+ package io.sentry.react;
2
+
3
+ import android.content.Context;
4
+ import com.facebook.react.bridge.ReadableMap;
5
+ import io.sentry.ILogger;
6
+ import io.sentry.Sentry;
7
+ import io.sentry.SentryLevel;
8
+ import io.sentry.android.core.AndroidLogger;
9
+ import io.sentry.android.core.SentryAndroidOptions;
10
+ import org.jetbrains.annotations.NotNull;
11
+ import org.json.JSONObject;
12
+
13
+ public final class RNSentrySDK {
14
+ private static final String CONFIGURATION_FILE = "sentry.options.json";
15
+ private static final String NAME = "RNSentrySDK";
16
+
17
+ private static final ILogger logger = new AndroidLogger(NAME);
18
+
19
+ private RNSentrySDK() {
20
+ throw new AssertionError("Utility class should not be instantiated");
21
+ }
22
+
23
+ static void init(
24
+ @NotNull final Context context,
25
+ @NotNull Sentry.OptionsConfiguration<SentryAndroidOptions> configuration,
26
+ @NotNull String configurationFile,
27
+ @NotNull ILogger logger) {
28
+ try {
29
+ JSONObject jsonObject =
30
+ RNSentryJsonUtils.getOptionsFromConfigurationFile(context, configurationFile, logger);
31
+ if (jsonObject == null) {
32
+ RNSentryStart.startWithConfiguration(context, configuration);
33
+ return;
34
+ }
35
+ ReadableMap rnOptions = RNSentryJsonConverter.convertToWritable(jsonObject);
36
+ if (rnOptions == null) {
37
+ RNSentryStart.startWithConfiguration(context, configuration);
38
+ return;
39
+ }
40
+ RNSentryStart.startWithOptions(context, rnOptions, configuration, logger);
41
+ } catch (Exception e) {
42
+ logger.log(
43
+ SentryLevel.ERROR, "Failed to start Sentry with options from configuration file.", e);
44
+ throw new RuntimeException("Failed to initialize Sentry's React Native SDK", e);
45
+ }
46
+ }
47
+
48
+ /**
49
+ * @experimental Start the Native Android SDK with the provided configuration options. Uses as a
50
+ * base configurations the `sentry.options.json` configuration file if it exists.
51
+ * @param context Android Context
52
+ * @param configuration configuration options
53
+ */
54
+ public static void init(
55
+ @NotNull final Context context,
56
+ @NotNull Sentry.OptionsConfiguration<SentryAndroidOptions> configuration) {
57
+ init(context, configuration, CONFIGURATION_FILE, logger);
58
+ }
59
+
60
+ /**
61
+ * @experimental Start the Native Android SDK with options from `sentry.options.json`
62
+ * configuration file.
63
+ * @param context Android Context
64
+ */
65
+ public static void init(@NotNull final Context context) {
66
+ init(context, options -> {}, CONFIGURATION_FILE, logger);
67
+ }
68
+ }
@@ -0,0 +1,417 @@
1
+ package io.sentry.react;
2
+
3
+ import android.app.Activity;
4
+ import android.content.Context;
5
+ import com.facebook.react.bridge.ReadableMap;
6
+ import com.facebook.react.bridge.ReadableType;
7
+ import com.facebook.react.common.JavascriptException;
8
+ import io.sentry.ILogger;
9
+ import io.sentry.ProfileLifecycle;
10
+ import io.sentry.Sentry;
11
+ import io.sentry.SentryEvent;
12
+ import io.sentry.SentryLevel;
13
+ import io.sentry.SentryOptions.BeforeSendCallback;
14
+ import io.sentry.SentryReplayOptions;
15
+ import io.sentry.UncaughtExceptionHandlerIntegration;
16
+ import io.sentry.android.core.AnrIntegration;
17
+ import io.sentry.android.core.BuildConfig;
18
+ import io.sentry.android.core.CurrentActivityHolder;
19
+ import io.sentry.android.core.NdkIntegration;
20
+ import io.sentry.android.core.SentryAndroid;
21
+ import io.sentry.android.core.SentryAndroidOptions;
22
+ import io.sentry.protocol.SdkVersion;
23
+ import io.sentry.react.replay.RNSentryReplayMask;
24
+ import io.sentry.react.replay.RNSentryReplayUnmask;
25
+ import java.net.URI;
26
+ import java.net.URISyntaxException;
27
+ import org.jetbrains.annotations.NotNull;
28
+ import org.jetbrains.annotations.Nullable;
29
+
30
+ final class RNSentryStart {
31
+
32
+ private RNSentryStart() {
33
+ throw new AssertionError("Utility class should not be instantiated");
34
+ }
35
+
36
+ static void startWithConfiguration(
37
+ @NotNull final Context context,
38
+ @NotNull Sentry.OptionsConfiguration<SentryAndroidOptions> configuration) {
39
+ Sentry.OptionsConfiguration<SentryAndroidOptions> defaults =
40
+ options -> updateWithReactDefaults(options, null);
41
+ RNSentryCompositeOptionsConfiguration compositeConfiguration =
42
+ new RNSentryCompositeOptionsConfiguration(
43
+ defaults, configuration, RNSentryStart::updateWithReactFinals);
44
+ SentryAndroid.init(context, compositeConfiguration);
45
+ }
46
+
47
+ static void startWithOptions(
48
+ @NotNull final Context context,
49
+ @NotNull final ReadableMap rnOptions,
50
+ @NotNull Sentry.OptionsConfiguration<SentryAndroidOptions> configuration,
51
+ @NotNull ILogger logger) {
52
+ Sentry.OptionsConfiguration<SentryAndroidOptions> defaults =
53
+ options -> updateWithReactDefaults(options, null);
54
+ Sentry.OptionsConfiguration<SentryAndroidOptions> rnConfigurationOptions =
55
+ options -> getSentryAndroidOptions(options, rnOptions, logger);
56
+ RNSentryCompositeOptionsConfiguration compositeConfiguration =
57
+ new RNSentryCompositeOptionsConfiguration(
58
+ rnConfigurationOptions, defaults, configuration, RNSentryStart::updateWithReactFinals);
59
+ SentryAndroid.init(context, compositeConfiguration);
60
+ }
61
+
62
+ static void startWithOptions(
63
+ @NotNull final Context context,
64
+ @NotNull final ReadableMap rnOptions,
65
+ @Nullable Activity currentActivity,
66
+ @NotNull ILogger logger) {
67
+ Sentry.OptionsConfiguration<SentryAndroidOptions> defaults =
68
+ options -> updateWithReactDefaults(options, currentActivity);
69
+ Sentry.OptionsConfiguration<SentryAndroidOptions> rnConfigurationOptions =
70
+ options -> getSentryAndroidOptions(options, rnOptions, logger);
71
+ RNSentryCompositeOptionsConfiguration compositeConfiguration =
72
+ new RNSentryCompositeOptionsConfiguration(
73
+ rnConfigurationOptions, defaults, RNSentryStart::updateWithReactFinals);
74
+ SentryAndroid.init(context, compositeConfiguration);
75
+ }
76
+
77
+ static void getSentryAndroidOptions(
78
+ @NotNull SentryAndroidOptions options,
79
+ @NotNull ReadableMap rnOptions,
80
+ @NotNull ILogger logger) {
81
+ if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
82
+ options.setDebug(true);
83
+ }
84
+ if (rnOptions.hasKey("dsn") && rnOptions.getString("dsn") != null) {
85
+ String dsn = rnOptions.getString("dsn");
86
+ logger.log(SentryLevel.INFO, String.format("Starting with DSN: '%s'", dsn));
87
+ options.setDsn(dsn);
88
+ } else {
89
+ // SentryAndroid needs an empty string fallback for the dsn.
90
+ options.setDsn("");
91
+ }
92
+ if (rnOptions.hasKey("sampleRate")) {
93
+ options.setSampleRate(rnOptions.getDouble("sampleRate"));
94
+ }
95
+ if (rnOptions.hasKey("sendClientReports")) {
96
+ options.setSendClientReports(rnOptions.getBoolean("sendClientReports"));
97
+ }
98
+ if (rnOptions.hasKey("maxBreadcrumbs")) {
99
+ options.setMaxBreadcrumbs(rnOptions.getInt("maxBreadcrumbs"));
100
+ }
101
+ if (rnOptions.hasKey("maxCacheItems")) {
102
+ options.setMaxCacheItems(rnOptions.getInt("maxCacheItems"));
103
+ }
104
+ if (rnOptions.hasKey("environment") && rnOptions.getString("environment") != null) {
105
+ options.setEnvironment(rnOptions.getString("environment"));
106
+ }
107
+ if (rnOptions.hasKey("release") && rnOptions.getString("release") != null) {
108
+ options.setRelease(rnOptions.getString("release"));
109
+ }
110
+ if (rnOptions.hasKey("dist") && rnOptions.getString("dist") != null) {
111
+ options.setDist(rnOptions.getString("dist"));
112
+ }
113
+ if (rnOptions.hasKey("enableAutoSessionTracking")) {
114
+ options.setEnableAutoSessionTracking(rnOptions.getBoolean("enableAutoSessionTracking"));
115
+ }
116
+ if (rnOptions.hasKey("sessionTrackingIntervalMillis")) {
117
+ options.setSessionTrackingIntervalMillis(rnOptions.getInt("sessionTrackingIntervalMillis"));
118
+ }
119
+ if (rnOptions.hasKey("shutdownTimeout")) {
120
+ options.setShutdownTimeoutMillis(rnOptions.getInt("shutdownTimeout"));
121
+ }
122
+ if (rnOptions.hasKey("enableNdkScopeSync")) {
123
+ options.setEnableScopeSync(rnOptions.getBoolean("enableNdkScopeSync"));
124
+ }
125
+ if (rnOptions.hasKey("attachStacktrace")) {
126
+ options.setAttachStacktrace(rnOptions.getBoolean("attachStacktrace"));
127
+ }
128
+ if (rnOptions.hasKey("attachThreads")) {
129
+ // JS use top level stacktrace and android attaches Threads which hides them so
130
+ // by default we hide.
131
+ options.setAttachThreads(rnOptions.getBoolean("attachThreads"));
132
+ }
133
+ if (rnOptions.hasKey("attachScreenshot")) {
134
+ options.setAttachScreenshot(rnOptions.getBoolean("attachScreenshot"));
135
+ }
136
+ if (rnOptions.hasKey("attachViewHierarchy")) {
137
+ options.setAttachViewHierarchy(rnOptions.getBoolean("attachViewHierarchy"));
138
+ }
139
+ if (rnOptions.hasKey("sendDefaultPii")) {
140
+ options.setSendDefaultPii(rnOptions.getBoolean("sendDefaultPii"));
141
+ }
142
+ if (rnOptions.hasKey("maxQueueSize")) {
143
+ options.setMaxQueueSize(rnOptions.getInt("maxQueueSize"));
144
+ }
145
+ if (rnOptions.hasKey("enableNdk")) {
146
+ options.setEnableNdk(rnOptions.getBoolean("enableNdk"));
147
+ }
148
+ if (rnOptions.hasKey("spotlight")) {
149
+ if (rnOptions.getType("spotlight") == ReadableType.Boolean) {
150
+ options.setEnableSpotlight(rnOptions.getBoolean("spotlight"));
151
+ if (rnOptions.hasKey("defaultSidecarUrl")) {
152
+ options.setSpotlightConnectionUrl(rnOptions.getString("defaultSidecarUrl"));
153
+ }
154
+ } else if (rnOptions.getType("spotlight") == ReadableType.String) {
155
+ options.setEnableSpotlight(true);
156
+ options.setSpotlightConnectionUrl(rnOptions.getString("spotlight"));
157
+ }
158
+ }
159
+
160
+ SentryReplayOptions replayOptions = getReplayOptions(rnOptions);
161
+ options.setSessionReplay(replayOptions);
162
+ if (isReplayEnabled(replayOptions)) {
163
+ options.getReplayController().setBreadcrumbConverter(new RNSentryReplayBreadcrumbConverter());
164
+ }
165
+
166
+ // Configure Android UI Profiling
167
+ configureAndroidProfiling(options, rnOptions, logger);
168
+
169
+ // Exclude Dev Server and Sentry Dsn request from Breadcrumbs
170
+ String dsn = rnOptions.hasKey("dsn") ? getURLFromDSN(rnOptions.getString("dsn")) : null;
171
+ String devServerUrl =
172
+ rnOptions.hasKey("devServerUrl") ? rnOptions.getString("devServerUrl") : null;
173
+ options.setBeforeBreadcrumb(
174
+ (breadcrumb, hint) -> {
175
+ Object urlObject = breadcrumb.getData("url");
176
+ String url = urlObject instanceof String ? (String) urlObject : "";
177
+ if ("http".equals(breadcrumb.getType())
178
+ && ((dsn != null && url.startsWith(dsn))
179
+ || (devServerUrl != null && url.startsWith(devServerUrl)))) {
180
+ return null;
181
+ }
182
+ return breadcrumb;
183
+ });
184
+
185
+ if (rnOptions.hasKey("enableNativeCrashHandling")
186
+ && !rnOptions.getBoolean("enableNativeCrashHandling")) {
187
+ options
188
+ .getIntegrations()
189
+ .removeIf(
190
+ integration ->
191
+ integration instanceof UncaughtExceptionHandlerIntegration
192
+ || integration instanceof AnrIntegration
193
+ || integration instanceof NdkIntegration);
194
+ }
195
+ logger.log(
196
+ SentryLevel.INFO, String.format("Native Integrations '%s'", options.getIntegrations()));
197
+ }
198
+
199
+ private static void configureAndroidProfiling(
200
+ @NotNull SentryAndroidOptions options,
201
+ @NotNull ReadableMap rnOptions,
202
+ @NotNull ILogger logger) {
203
+ if (!rnOptions.hasKey("_experiments")) {
204
+ return;
205
+ }
206
+
207
+ @Nullable final ReadableMap experiments = rnOptions.getMap("_experiments");
208
+ if (experiments == null || !experiments.hasKey("androidProfilingOptions")) {
209
+ return;
210
+ }
211
+
212
+ @Nullable
213
+ final ReadableMap androidProfilingOptions = experiments.getMap("androidProfilingOptions");
214
+ if (androidProfilingOptions == null) {
215
+ return;
216
+ }
217
+
218
+ // Set profile session sample rate
219
+ if (androidProfilingOptions.hasKey("profileSessionSampleRate")) {
220
+ if (androidProfilingOptions.getType("profileSessionSampleRate") == ReadableType.Number) {
221
+ final double profileSessionSampleRate =
222
+ androidProfilingOptions.getDouble("profileSessionSampleRate");
223
+ options.setProfileSessionSampleRate(profileSessionSampleRate);
224
+ logger.log(
225
+ SentryLevel.INFO,
226
+ String.format(
227
+ "Android UI Profiling profileSessionSampleRate set to: %.2f",
228
+ profileSessionSampleRate));
229
+ } else {
230
+ logger.log(
231
+ SentryLevel.WARNING,
232
+ "Android UI Profiling profileSessionSampleRate must be a number, ignoring invalid"
233
+ + " value");
234
+ }
235
+ }
236
+
237
+ // Set profiling lifecycle mode
238
+ if (androidProfilingOptions.hasKey("lifecycle")) {
239
+ if (androidProfilingOptions.getType("lifecycle") == ReadableType.String) {
240
+ final String lifecycle = androidProfilingOptions.getString("lifecycle");
241
+ if ("manual".equalsIgnoreCase(lifecycle)) {
242
+ options.setProfileLifecycle(ProfileLifecycle.MANUAL);
243
+ logger.log(SentryLevel.INFO, "Android UI Profile Lifecycle set to MANUAL");
244
+ } else if ("trace".equalsIgnoreCase(lifecycle)) {
245
+ options.setProfileLifecycle(ProfileLifecycle.TRACE);
246
+ logger.log(SentryLevel.INFO, "Android UI Profile Lifecycle set to TRACE");
247
+ }
248
+ } else {
249
+ logger.log(
250
+ SentryLevel.WARNING,
251
+ "Android UI Profiling lifecycle must be a string, ignoring invalid value");
252
+ }
253
+ }
254
+
255
+ // Set start on app start
256
+ if (androidProfilingOptions.hasKey("startOnAppStart")) {
257
+ if (androidProfilingOptions.getType("startOnAppStart") == ReadableType.Boolean) {
258
+ final boolean startOnAppStart = androidProfilingOptions.getBoolean("startOnAppStart");
259
+ options.setStartProfilerOnAppStart(startOnAppStart);
260
+ logger.log(
261
+ SentryLevel.INFO,
262
+ String.format("Android UI Profiling startOnAppStart set to %b", startOnAppStart));
263
+ } else {
264
+ logger.log(
265
+ SentryLevel.WARNING,
266
+ "Android UI Profiling startOnAppStart must be a boolean, ignoring invalid value");
267
+ }
268
+ }
269
+ }
270
+
271
+ /**
272
+ * This function updates the options with RNSentry defaults. These default can be overwritten by
273
+ * users during manual native initialization.
274
+ */
275
+ static void updateWithReactDefaults(
276
+ @NotNull SentryAndroidOptions options, @Nullable Activity currentActivity) {
277
+ @Nullable SdkVersion sdkVersion = options.getSdkVersion();
278
+ if (sdkVersion == null) {
279
+ sdkVersion = new SdkVersion(RNSentryVersion.ANDROID_SDK_NAME, BuildConfig.VERSION_NAME);
280
+ } else {
281
+ sdkVersion.setName(RNSentryVersion.ANDROID_SDK_NAME);
282
+ }
283
+ sdkVersion.addPackage(
284
+ RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_NAME,
285
+ RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_VERSION);
286
+
287
+ options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
288
+ options.setNativeSdkName(RNSentryVersion.NATIVE_SDK_NAME);
289
+ options.setSdkVersion(sdkVersion);
290
+
291
+ // Tracing is only enabled in JS to avoid duplicate navigation spans
292
+ options.setTracesSampleRate(null);
293
+ options.setTracesSampler(null);
294
+
295
+ // React native internally throws a JavascriptException.
296
+ // we want to ignore it on the native side to avoid sending it twice.
297
+ options.addIgnoredExceptionForType(JavascriptException.class);
298
+
299
+ setCurrentActivity(currentActivity);
300
+ }
301
+
302
+ /**
303
+ * This function updates options with changes RNSentry users should not change and so this is
304
+ * applied after the configureOptions callback during manual native initialization.
305
+ */
306
+ static void updateWithReactFinals(@NotNull SentryAndroidOptions options) {
307
+ BeforeSendCallback userBeforeSend = options.getBeforeSend();
308
+ options.setBeforeSend(
309
+ (event, hint) -> {
310
+ setEventOriginTag(event);
311
+ // Note: In Sentry Android SDK v7, native SDK packages/integrations are already
312
+ // included in the SDK version set during initialization, so no need to copy them here.
313
+ if (userBeforeSend != null) {
314
+ return userBeforeSend.execute(event, hint);
315
+ }
316
+ return event;
317
+ });
318
+ }
319
+
320
+ private static void setCurrentActivity(Activity currentActivity) {
321
+ final CurrentActivityHolder currentActivityHolder = CurrentActivityHolder.getInstance();
322
+ if (currentActivity != null) {
323
+ currentActivityHolder.setActivity(currentActivity);
324
+ }
325
+ }
326
+
327
+ private static boolean isReplayEnabled(SentryReplayOptions replayOptions) {
328
+ return replayOptions.getSessionSampleRate() != null
329
+ || replayOptions.getOnErrorSampleRate() != null;
330
+ }
331
+
332
+ private static SentryReplayOptions getReplayOptions(@NotNull ReadableMap rnOptions) {
333
+ final SdkVersion replaySdkVersion =
334
+ new SdkVersion(
335
+ RNSentryVersion.REACT_NATIVE_SDK_NAME,
336
+ RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_VERSION);
337
+ @NotNull
338
+ final SentryReplayOptions androidReplayOptions =
339
+ new SentryReplayOptions(false, replaySdkVersion);
340
+
341
+ if (!(rnOptions.hasKey("replaysSessionSampleRate")
342
+ || rnOptions.hasKey("replaysOnErrorSampleRate"))) {
343
+ return androidReplayOptions;
344
+ }
345
+
346
+ androidReplayOptions.setSessionSampleRate(
347
+ rnOptions.hasKey("replaysSessionSampleRate")
348
+ ? rnOptions.getDouble("replaysSessionSampleRate")
349
+ : null);
350
+ androidReplayOptions.setOnErrorSampleRate(
351
+ rnOptions.hasKey("replaysOnErrorSampleRate")
352
+ ? rnOptions.getDouble("replaysOnErrorSampleRate")
353
+ : null);
354
+
355
+ if (!rnOptions.hasKey("mobileReplayOptions")) {
356
+ return androidReplayOptions;
357
+ }
358
+ @Nullable final ReadableMap rnMobileReplayOptions = rnOptions.getMap("mobileReplayOptions");
359
+ if (rnMobileReplayOptions == null) {
360
+ return androidReplayOptions;
361
+ }
362
+
363
+ androidReplayOptions.setMaskAllText(
364
+ !rnMobileReplayOptions.hasKey("maskAllText")
365
+ || rnMobileReplayOptions.getBoolean("maskAllText"));
366
+ androidReplayOptions.setMaskAllImages(
367
+ !rnMobileReplayOptions.hasKey("maskAllImages")
368
+ || rnMobileReplayOptions.getBoolean("maskAllImages"));
369
+
370
+ final boolean redactVectors =
371
+ !rnMobileReplayOptions.hasKey("maskAllVectors")
372
+ || rnMobileReplayOptions.getBoolean("maskAllVectors");
373
+ if (redactVectors) {
374
+ androidReplayOptions.addMaskViewClass("com.horcrux.svg.SvgView"); // react-native-svg
375
+ }
376
+
377
+ androidReplayOptions.setMaskViewContainerClass(RNSentryReplayMask.class.getName());
378
+ androidReplayOptions.setUnmaskViewContainerClass(RNSentryReplayUnmask.class.getName());
379
+
380
+ return androidReplayOptions;
381
+ }
382
+
383
+ private static void setEventOriginTag(SentryEvent event) {
384
+ // We hardcode native-java as only java events are processed by the Android SDK.
385
+ SdkVersion sdk = event.getSdk();
386
+ if (sdk != null) {
387
+ switch (sdk.getName()) {
388
+ case RNSentryVersion.NATIVE_SDK_NAME:
389
+ setEventEnvironmentTag(event, "native");
390
+ break;
391
+ case RNSentryVersion.ANDROID_SDK_NAME:
392
+ setEventEnvironmentTag(event, "java");
393
+ break;
394
+ default:
395
+ break;
396
+ }
397
+ }
398
+ }
399
+
400
+ private static void setEventEnvironmentTag(SentryEvent event, String environment) {
401
+ event.setTag("event.origin", "android");
402
+ event.setTag("event.environment", environment);
403
+ }
404
+
405
+ private static @Nullable String getURLFromDSN(@Nullable String dsn) {
406
+ if (dsn == null) {
407
+ return null;
408
+ }
409
+ URI uri = null;
410
+ try {
411
+ uri = new URI(dsn);
412
+ } catch (URISyntaxException e) {
413
+ return null;
414
+ }
415
+ return uri.getScheme() + "://" + uri.getHost();
416
+ }
417
+ }
@@ -2,7 +2,7 @@ package io.sentry.react;
2
2
 
3
3
  class RNSentryVersion {
4
4
  static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5
- static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.10.0";
5
+ static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "8.0.0-alpha.0";
6
6
  static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
7
7
  static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
8
8
  static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
@@ -112,6 +112,16 @@ public class RNSentryModule extends NativeRNSentrySpec {
112
112
  this.impl.setTag(key, value);
113
113
  }
114
114
 
115
+ @Override
116
+ public void setAttribute(String key, String value) {
117
+ this.impl.setAttribute(key, value);
118
+ }
119
+
120
+ @Override
121
+ public void setAttributes(ReadableMap attributes) {
122
+ this.impl.setAttributes(attributes);
123
+ }
124
+
115
125
  @Override
116
126
  public void closeNativeSdk(Promise promise) {
117
127
  this.impl.closeNativeSdk(promise);
@@ -112,6 +112,16 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
112
112
  this.impl.setTag(key, value);
113
113
  }
114
114
 
115
+ @ReactMethod
116
+ public void setAttribute(String key, String value) {
117
+ this.impl.setAttribute(key, value);
118
+ }
119
+
120
+ @ReactMethod
121
+ public void setAttributes(ReadableMap attributes) {
122
+ this.impl.setAttributes(attributes);
123
+ }
124
+
115
125
  @ReactMethod
116
126
  public void closeNativeSdk(Promise promise) {
117
127
  this.impl.closeNativeSdk(promise);
@@ -132,6 +142,11 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
132
142
  this.impl.fetchNativeDeviceContexts(promise);
133
143
  }
134
144
 
145
+ @ReactMethod
146
+ public void fetchNativeLogAttributes(Promise promise) {
147
+ this.impl.fetchNativeLogAttributes(promise);
148
+ }
149
+
135
150
  @ReactMethod
136
151
  public void fetchNativeSdkInfo(Promise promise) {
137
152
  this.impl.fetchNativeSdkInfo(promise);
@@ -25,6 +25,8 @@ export interface Spec extends TurboModule {
25
25
  setContext(key: string, value: UnsafeObject | null): void;
26
26
  setExtra(key: string, value: string): void;
27
27
  setTag(key: string, value: string): void;
28
+ setAttribute(key: string, value: string): void;
29
+ setAttributes(attributes: UnsafeObject): void;
28
30
  enableNativeFramesTracking(): void;
29
31
  fetchModules(): Promise<string | undefined | null>;
30
32
  fetchViewHierarchy(): Promise<number[] | undefined | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,yBAAyB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IAChE,aAAa,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC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E,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;;AAGF,wBAAkE"}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA6JnD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/core';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nimport type { UnsafeObject } from './utils/rnlibrariesinterface';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addListener: (eventType: string) => void;\n removeListeners: (id: number) => void;\n getNewScreenTimeToDisplay(): Promise<number | undefined | null>;\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: string,\n options: {\n hardCrashed: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package | null>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeLogAttributes(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(defaultUserKeys: UnsafeObject | null, otherUserKeys: UnsafeObject | null): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n fetchViewHierarchy(): Promise<number[] | undefined | null>;\n startProfiling(platformProfilers: boolean): { started?: boolean; error?: string };\n stopProfiling(): {\n profile?: string;\n nativeProfile?: UnsafeObject;\n androidProfile?: UnsafeObject;\n error?: string;\n };\n fetchNativePackageName(): string | undefined | null;\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;\n initNativeReactNavigationNewFrameTracking(): Promise<void>;\n captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;\n getCurrentReplayId(): string | undefined | null;\n crashedLastRun(): Promise<boolean | undefined | null>;\n getDataFromUri(uri: string): Promise<number[]>;\n popTimeToDisplayFor(key: string): Promise<number | undefined | null>;\n setActiveSpanId(spanId: string): boolean;\n encodeToBase64(data: number[]): Promise<string | undefined | null>;\n}\n\nexport type NativeStackFrame = {\n platform: string;\n /**\n * The instruction address of this frame.\n * Formatted as hex with 0x prefix.\n */\n instruction_addr: string;\n package?: string;\n /**\n * The debug image address of this frame.\n * Formatted as hex with 0x prefix.\n */\n image_addr?: string;\n in_app?: boolean;\n /**\n * The symbol name of this frame.\n * If symbolicated locally.\n */\n function?: string;\n /**\n * The symbol address of this frame.\n * If symbolicated locally.\n * Formatted as hex with 0x prefix.\n */\n symbol_addr?: string;\n};\n\nexport type NativeDebugImage = {\n name?: string;\n type?: string;\n uuid?: string;\n debug_id?: string;\n image_addr?: string;\n image_size?: number;\n code_file?: string;\n image_vmaddr?: string;\n};\n\nexport type NativeStackFrames = {\n frames: NativeStackFrame[];\n debugMetaImages?: NativeDebugImage[];\n};\n\nexport type NativeAppStartResponse = {\n type: 'cold' | 'warm' | 'unknown';\n has_fetched: boolean;\n app_start_timestamp_ms?: number;\n spans: {\n description: string;\n start_timestamp_ms: number;\n end_timestamp_ms: number;\n }[];\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa and sentry-android\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n * https://github.com/getsentry/sentry-java/blob/a461f7e125b65240004e6162b341f383ce2e1394/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java#L32\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n contexts?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
1
+ {"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA+JnD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/core';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nimport type { UnsafeObject } from './utils/rnlibrariesinterface';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addListener: (eventType: string) => void;\n removeListeners: (id: number) => void;\n getNewScreenTimeToDisplay(): Promise<number | undefined | null>;\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: string,\n options: {\n hardCrashed: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package | null>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeLogAttributes(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(defaultUserKeys: UnsafeObject | null, otherUserKeys: UnsafeObject | null): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n setAttribute(key: string, value: string): void;\n setAttributes(attributes: UnsafeObject): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n fetchViewHierarchy(): Promise<number[] | undefined | null>;\n startProfiling(platformProfilers: boolean): { started?: boolean; error?: string };\n stopProfiling(): {\n profile?: string;\n nativeProfile?: UnsafeObject;\n androidProfile?: UnsafeObject;\n error?: string;\n };\n fetchNativePackageName(): string | undefined | null;\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;\n initNativeReactNavigationNewFrameTracking(): Promise<void>;\n captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;\n getCurrentReplayId(): string | undefined | null;\n crashedLastRun(): Promise<boolean | undefined | null>;\n getDataFromUri(uri: string): Promise<number[]>;\n popTimeToDisplayFor(key: string): Promise<number | undefined | null>;\n setActiveSpanId(spanId: string): boolean;\n encodeToBase64(data: number[]): Promise<string | undefined | null>;\n}\n\nexport type NativeStackFrame = {\n platform: string;\n /**\n * The instruction address of this frame.\n * Formatted as hex with 0x prefix.\n */\n instruction_addr: string;\n package?: string;\n /**\n * The debug image address of this frame.\n * Formatted as hex with 0x prefix.\n */\n image_addr?: string;\n in_app?: boolean;\n /**\n * The symbol name of this frame.\n * If symbolicated locally.\n */\n function?: string;\n /**\n * The symbol address of this frame.\n * If symbolicated locally.\n * Formatted as hex with 0x prefix.\n */\n symbol_addr?: string;\n};\n\nexport type NativeDebugImage = {\n name?: string;\n type?: string;\n uuid?: string;\n debug_id?: string;\n image_addr?: string;\n image_size?: number;\n code_file?: string;\n image_vmaddr?: string;\n};\n\nexport type NativeStackFrames = {\n frames: NativeStackFrame[];\n debugMetaImages?: NativeDebugImage[];\n};\n\nexport type NativeAppStartResponse = {\n type: 'cold' | 'warm' | 'unknown';\n has_fetched: boolean;\n app_start_timestamp_ms?: number;\n spans: {\n description: string;\n start_timestamp_ms: number;\n end_timestamp_ms: number;\n }[];\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa and sentry-android\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n * https://github.com/getsentry/sentry-java/blob/a461f7e125b65240004e6162b341f383ce2e1394/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java#L32\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n contexts?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}