Skip to content

Commit 135da92

Browse files
authored
Merge branch 'main' into antonis/rn-0.83.1
2 parents b5ab8c4 + b1579bc commit 135da92

File tree

42 files changed

+1021
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1021
-107
lines changed

CHANGELOG.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,48 @@
66
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
77
<!-- prettier-ignore-end -->
88
9-
## Unreleased
9+
## 7.12.0
10+
11+
### Features
12+
13+
- Extends the experimental support of UI profiling to iOS ([#5611](https://github.com/getsentry/sentry-react-native/pull/5611))
14+
```js
15+
Sentry.init({
16+
_experiments: {
17+
profilingOptions: {
18+
profileSessionSampleRate: 1.0,
19+
lifecycle: 'trace', // or 'manual'
20+
startOnAppStart: true,
21+
},
22+
},
23+
});
24+
```
25+
- Note that the `androidProfilingOptions` key is now deprecated, and `profilingOptions` should be used instead
26+
- Add performance tracking for Expo Router route prefetching ([#5606](https://github.com/getsentry/sentry-react-native/pull/5606))
27+
- New `wrapExpoRouter` utility to instrument manual `prefetch()` calls with performance spans
28+
- New `enablePrefetchTracking` option for `reactNavigationIntegration` to automatically track PRELOAD actions
29+
```tsx
30+
// Option 1: Wrap the router for manual prefetch tracking
31+
import { wrapExpoRouter } from '@sentry/react-native';
32+
import { useRouter } from 'expo-router';
33+
34+
const router = wrapExpoRouter(useRouter());
35+
router.prefetch('/details'); // Creates a span measuring prefetch performance
36+
37+
// Option 2: Enable automatic prefetch tracking in the integration
38+
Sentry.init({
39+
integrations: [
40+
Sentry.reactNavigationIntegration({
41+
enablePrefetchTracking: true,
42+
}),
43+
],
44+
});
45+
```
46+
47+
### Fixes
48+
49+
- Fix `SENTRY_ALLOW_FAILURE` environment variable not being respected in Xcode build scripts ([#5616](https://github.com/getsentry/sentry-react-native/pull/5616))
50+
- Fix iOS dSYM upload for main app in Expo EAS builds by adding inputPaths to build phase ([#5617](https://github.com/getsentry/sentry-react-native/pull/5617))
1051

1152
### Dependencies
1253

dev-packages/e2e-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-e2e-tests",
3-
"version": "7.11.0",
3+
"version": "7.12.0",
44
"private": true,
55
"description": "Sentry React Native End to End Tests Library",
66
"main": "dist/index.js",
@@ -14,7 +14,7 @@
1414
"@babel/preset-env": "^7.25.3",
1515
"@babel/preset-typescript": "^7.18.6",
1616
"@sentry/core": "10.38.0",
17-
"@sentry/react-native": "7.11.0",
17+
"@sentry/react-native": "7.12.0",
1818
"@types/node": "^20.9.3",
1919
"@types/react": "^18.2.64",
2020
"appium": "2.4.1",

dev-packages/e2e-tests/patch-scripts/rn.patch.app.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ Sentry.init({
2727
release: '${SENTRY_RELEASE}',
2828
dist: '${SENTRY_DIST}',
2929
dsn: 'https://1df17bd4e543fdb31351dee1768bb679@o447951.ingest.sentry.io/5428561',
30-
_experiments: {
31-
replaysOnErrorSampleRate: LaunchArguments.value().replaysOnErrorSampleRate,
32-
},
30+
replaysOnErrorSampleRate: LaunchArguments.value().replaysOnErrorSampleRate,
3331
integrations: [
3432
Sentry.mobileReplayIntegration(),
3533
Sentry.feedbackIntegration({

dev-packages/type-check/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sentry-react-native-type-check",
33
"private": true,
4-
"version": "7.11.0",
4+
"version": "7.12.0",
55
"scripts": {
66
"type-check": "./run-type-check.sh"
77
}

dev-packages/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-samples-utils",
3-
"version": "7.11.0",
3+
"version": "7.12.0",
44
"description": "Internal Samples Utils",
55
"main": "index.js",
66
"license": "MIT",

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "7.11.0",
3+
"version": "7.12.0",
44
"packages": [
55
"packages/*",
66
"dev-packages/*",

packages/core/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -494,47 +494,44 @@ private void configureAndroidProfiling(
494494
}
495495

496496
@Nullable final ReadableMap experiments = rnOptions.getMap("_experiments");
497-
if (experiments == null || !experiments.hasKey("androidProfilingOptions")) {
497+
if (experiments == null || !experiments.hasKey("profilingOptions")) {
498498
return;
499499
}
500500

501-
@Nullable
502-
final ReadableMap androidProfilingOptions = experiments.getMap("androidProfilingOptions");
503-
if (androidProfilingOptions == null) {
501+
@Nullable final ReadableMap profilingOptions = experiments.getMap("profilingOptions");
502+
if (profilingOptions == null) {
504503
return;
505504
}
506505

507506
// Set profile session sample rate
508-
if (androidProfilingOptions.hasKey("profileSessionSampleRate")) {
507+
if (profilingOptions.hasKey("profileSessionSampleRate")) {
509508
final double profileSessionSampleRate =
510-
androidProfilingOptions.getDouble("profileSessionSampleRate");
509+
profilingOptions.getDouble("profileSessionSampleRate");
511510
options.setProfileSessionSampleRate(profileSessionSampleRate);
512511
logger.log(
513512
SentryLevel.INFO,
514513
String.format(
515-
"Android UI Profiling profileSessionSampleRate set to: %.2f",
516-
profileSessionSampleRate));
514+
"UI Profiling profileSessionSampleRate set to: %.2f", profileSessionSampleRate));
517515
}
518516

519517
// Set profiling lifecycle mode
520-
if (androidProfilingOptions.hasKey("lifecycle")) {
521-
final String lifecycle = androidProfilingOptions.getString("lifecycle");
518+
if (profilingOptions.hasKey("lifecycle")) {
519+
final String lifecycle = profilingOptions.getString("lifecycle");
522520
if ("manual".equalsIgnoreCase(lifecycle)) {
523521
options.setProfileLifecycle(ProfileLifecycle.MANUAL);
524-
logger.log(SentryLevel.INFO, "Android UI Profile Lifecycle set to MANUAL");
522+
logger.log(SentryLevel.INFO, "UI Profile Lifecycle set to MANUAL");
525523
} else if ("trace".equalsIgnoreCase(lifecycle)) {
526524
options.setProfileLifecycle(ProfileLifecycle.TRACE);
527-
logger.log(SentryLevel.INFO, "Android UI Profile Lifecycle set to TRACE");
525+
logger.log(SentryLevel.INFO, "UI Profile Lifecycle set to TRACE");
528526
}
529527
}
530528

531529
// Set start on app start
532-
if (androidProfilingOptions.hasKey("startOnAppStart")) {
533-
final boolean startOnAppStart = androidProfilingOptions.getBoolean("startOnAppStart");
530+
if (profilingOptions.hasKey("startOnAppStart")) {
531+
final boolean startOnAppStart = profilingOptions.getBoolean("startOnAppStart");
534532
options.setStartProfilerOnAppStart(startOnAppStart);
535533
logger.log(
536-
SentryLevel.INFO,
537-
String.format("Android UI Profiling startOnAppStart set to %b", startOnAppStart));
534+
SentryLevel.INFO, String.format("Profiling startOnAppStart set to %b", startOnAppStart));
538535
}
539536
}
540537

packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class RNSentryVersion {
44
static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5-
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.11.0";
5+
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.12.0";
66
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
77
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
88
static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";

packages/core/ios/RNSentryExperimentalOptions.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ NS_ASSUME_NONNULL_BEGIN
3737
+ (void)setEnableSessionReplayInUnreliableEnvironment:(BOOL)enabled
3838
sentryOptions:(SentryOptions *)sentryOptions;
3939

40+
/**
41+
* Configures iOS UI profiling options on SentryOptions
42+
* @param profilingOptions Dictionary containing profiling configuration
43+
* @param sentryOptions The SentryOptions instance to configure
44+
*/
45+
+ (void)configureProfilingWithOptions:(NSDictionary *)profilingOptions
46+
sentryOptions:(SentryOptions *)sentryOptions;
47+
4048
@end
4149

4250
NS_ASSUME_NONNULL_END

packages/core/ios/RNSentryExperimentalOptions.m

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#import "RNSentryExperimentalOptions.h"
2+
#import <Sentry/SentryProfilingConditionals.h>
23
@import Sentry;
34

45
@implementation RNSentryExperimentalOptions
@@ -36,4 +37,45 @@ + (void)setEnableSessionReplayInUnreliableEnvironment:(BOOL)enabled
3637
sentryOptions.experimental.enableSessionReplayInUnreliableEnvironment = enabled;
3738
}
3839

40+
+ (void)configureProfilingWithOptions:(NSDictionary *)profilingOptions
41+
sentryOptions:(SentryOptions *)sentryOptions
42+
{
43+
#if SENTRY_TARGET_PROFILING_SUPPORTED
44+
if (sentryOptions == nil || profilingOptions == nil) {
45+
return;
46+
}
47+
48+
sentryOptions.configureProfiling = ^(SentryProfileOptions *_Nonnull profiling) {
49+
// Set session sample rate
50+
id profileSessionSampleRate = profilingOptions[@"profileSessionSampleRate"];
51+
if (profileSessionSampleRate != nil &&
52+
[profileSessionSampleRate isKindOfClass:[NSNumber class]]) {
53+
profiling.sessionSampleRate = [profileSessionSampleRate floatValue];
54+
NSLog(@"Sentry: UI Profiling sessionSampleRate set to: %.2f",
55+
profiling.sessionSampleRate);
56+
}
57+
58+
// Set lifecycle mode
59+
NSString *lifecycle = profilingOptions[@"lifecycle"];
60+
if ([lifecycle isKindOfClass:[NSString class]]) {
61+
if ([lifecycle caseInsensitiveCompare:@"manual"] == NSOrderedSame) {
62+
profiling.lifecycle = SentryProfileLifecycleManual;
63+
NSLog(@"Sentry: UI Profiling Lifecycle set to MANUAL");
64+
} else if ([lifecycle caseInsensitiveCompare:@"trace"] == NSOrderedSame) {
65+
profiling.lifecycle = SentryProfileLifecycleTrace;
66+
NSLog(@"Sentry: UI Profiling Lifecycle set to TRACE");
67+
}
68+
}
69+
70+
// Set profile app starts
71+
id startOnAppStart = profilingOptions[@"startOnAppStart"];
72+
if (startOnAppStart != nil && [startOnAppStart isKindOfClass:[NSNumber class]]) {
73+
profiling.profileAppStarts = [startOnAppStart boolValue];
74+
NSLog(@"Sentry: UI Profiling profileAppStarts set to %@",
75+
profiling.profileAppStarts ? @"YES" : @"NO");
76+
}
77+
};
78+
#endif
79+
}
80+
3981
@end

0 commit comments

Comments
 (0)