@sentry/react-native 3.2.9 → 3.2.10
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.
- package/CHANGELOG.md +6 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModule.java +51 -25
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.2.10
|
|
4
|
+
|
|
5
|
+
- fix: Do not crash if androidx.core isn't available on Android #1981
|
|
6
|
+
- fix: App start measurement on Android #1985
|
|
7
|
+
- Bump: Sentry Android to 5.5.2 #1985
|
|
8
|
+
|
|
3
9
|
## 3.2.9
|
|
4
10
|
|
|
5
11
|
- Deprecate initialScope in favor of configureScope #1963
|
package/android/build.gradle
CHANGED
|
@@ -52,20 +52,21 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
52
52
|
|
|
53
53
|
public static final String NAME = "RNSentry";
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
private static final Logger logger = Logger.getLogger("react-native-sentry");
|
|
56
56
|
|
|
57
|
-
private
|
|
58
|
-
private
|
|
59
|
-
private
|
|
57
|
+
private PackageInfo packageInfo = null;
|
|
58
|
+
private boolean didFetchAppStart;
|
|
59
|
+
private FrameMetricsAggregator frameMetricsAggregator = null;
|
|
60
|
+
private boolean androidXAvailable = true;
|
|
60
61
|
|
|
61
62
|
// 700ms to constitute frozen frames.
|
|
62
|
-
private final int FROZEN_FRAME_THRESHOLD = 700;
|
|
63
|
+
private static final int FROZEN_FRAME_THRESHOLD = 700;
|
|
63
64
|
// 16ms (slower than 60fps) to constitute slow frames.
|
|
64
|
-
private final int SLOW_FRAME_THRESHOLD = 16;
|
|
65
|
+
private static final int SLOW_FRAME_THRESHOLD = 16;
|
|
65
66
|
|
|
66
67
|
public RNSentryModule(ReactApplicationContext reactContext) {
|
|
67
68
|
super(reactContext);
|
|
68
|
-
|
|
69
|
+
packageInfo = getPackageInfo(reactContext);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
@Override
|
|
@@ -130,17 +131,23 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
130
131
|
}
|
|
131
132
|
if (rnOptions.hasKey("enableAutoPerformanceTracking")
|
|
132
133
|
&& rnOptions.getBoolean("enableAutoPerformanceTracking")) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
androidXAvailable = checkAndroidXAvailability();
|
|
135
|
+
|
|
136
|
+
if (androidXAvailable) {
|
|
137
|
+
frameMetricsAggregator = new FrameMetricsAggregator();
|
|
138
|
+
final Activity currentActivity = getCurrentActivity();
|
|
139
|
+
|
|
140
|
+
if (frameMetricsAggregator != null && currentActivity != null) {
|
|
141
|
+
try {
|
|
142
|
+
frameMetricsAggregator.add(currentActivity);
|
|
143
|
+
} catch (Throwable ignored) {
|
|
144
|
+
// throws ConcurrentModification when calling addOnFrameMetricsAvailableListener
|
|
145
|
+
// this is a best effort since we can't reproduce it
|
|
146
|
+
logger.warning("Error adding Activity to frameMetricsAggregator.");
|
|
147
|
+
}
|
|
143
148
|
}
|
|
149
|
+
} else {
|
|
150
|
+
logger.warning("androidx.core' isn't available as a dependency.");
|
|
144
151
|
}
|
|
145
152
|
} else {
|
|
146
153
|
this.disableNativeFramesTracking();
|
|
@@ -199,8 +206,13 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
199
206
|
public void fetchNativeAppStart(Promise promise) {
|
|
200
207
|
final AppStartState appStartInstance = AppStartState.getInstance();
|
|
201
208
|
final Date appStartTime = appStartInstance.getAppStartTime();
|
|
209
|
+
final Boolean isColdStart = appStartInstance.isColdStart();
|
|
202
210
|
|
|
203
211
|
if (appStartTime == null) {
|
|
212
|
+
logger.warning("App start won't be sent due to missing appStartTime.");
|
|
213
|
+
promise.resolve(null);
|
|
214
|
+
} else if (isColdStart == null) {
|
|
215
|
+
logger.warning("App start won't be sent due to missing isColdStart.");
|
|
204
216
|
promise.resolve(null);
|
|
205
217
|
} else {
|
|
206
218
|
final double appStartTimestamp = (double) appStartTime.getTime();
|
|
@@ -208,15 +220,15 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
208
220
|
WritableMap appStart = Arguments.createMap();
|
|
209
221
|
|
|
210
222
|
appStart.putDouble("appStartTime", appStartTimestamp);
|
|
211
|
-
appStart.putBoolean("isColdStart",
|
|
212
|
-
appStart.putBoolean("didFetchAppStart",
|
|
223
|
+
appStart.putBoolean("isColdStart", isColdStart);
|
|
224
|
+
appStart.putBoolean("didFetchAppStart", didFetchAppStart);
|
|
213
225
|
|
|
214
226
|
promise.resolve(appStart);
|
|
215
227
|
}
|
|
216
228
|
// This is always set to true, as we would only allow an app start fetch to only
|
|
217
229
|
// happen once in the case of a JS bundle reload, we do not want it to be
|
|
218
230
|
// instrumented again.
|
|
219
|
-
|
|
231
|
+
didFetchAppStart = true;
|
|
220
232
|
}
|
|
221
233
|
|
|
222
234
|
/**
|
|
@@ -224,7 +236,7 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
224
236
|
*/
|
|
225
237
|
@ReactMethod
|
|
226
238
|
public void fetchNativeFrames(Promise promise) {
|
|
227
|
-
if (
|
|
239
|
+
if (!isFrameMetricsAggregatorAvailable()) {
|
|
228
240
|
promise.resolve(null);
|
|
229
241
|
} else {
|
|
230
242
|
try {
|
|
@@ -232,7 +244,7 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
232
244
|
int slowFrames = 0;
|
|
233
245
|
int frozenFrames = 0;
|
|
234
246
|
|
|
235
|
-
final SparseIntArray[] framesRates =
|
|
247
|
+
final SparseIntArray[] framesRates = frameMetricsAggregator.getMetrics();
|
|
236
248
|
|
|
237
249
|
if (framesRates != null) {
|
|
238
250
|
final SparseIntArray totalIndexArray = framesRates[FrameMetricsAggregator.TOTAL_INDEX];
|
|
@@ -436,9 +448,9 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
436
448
|
|
|
437
449
|
@ReactMethod
|
|
438
450
|
public void disableNativeFramesTracking() {
|
|
439
|
-
if (
|
|
440
|
-
|
|
441
|
-
|
|
451
|
+
if (isFrameMetricsAggregatorAvailable()) {
|
|
452
|
+
frameMetricsAggregator.stop();
|
|
453
|
+
frameMetricsAggregator = null;
|
|
442
454
|
}
|
|
443
455
|
}
|
|
444
456
|
|
|
@@ -485,4 +497,18 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
485
497
|
event.setSdk(eventSdk);
|
|
486
498
|
}
|
|
487
499
|
}
|
|
500
|
+
|
|
501
|
+
private boolean checkAndroidXAvailability() {
|
|
502
|
+
try {
|
|
503
|
+
Class.forName("androidx.core.app.FrameMetricsAggregator");
|
|
504
|
+
return true;
|
|
505
|
+
} catch (ClassNotFoundException ignored) {
|
|
506
|
+
// androidx.core isn't available.
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
private boolean isFrameMetricsAggregatorAvailable() {
|
|
512
|
+
return androidXAvailable && frameMetricsAggregator != null;
|
|
513
|
+
}
|
|
488
514
|
}
|
package/dist/js/version.d.ts
CHANGED
package/dist/js/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,WAAW,CAAC"}
|
package/dist/js/version.js
CHANGED
package/dist/js/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.react-native\";\nexport const SDK_VERSION = \"3.2.10\";\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "3.2.
|
|
5
|
+
"version": "3.2.10",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|