Skip to content

Commit 44fea31

Browse files
authored
fix: Mobile onboarding feature snippets (#12956)
* fixes Apple onboarding feature snippets * updates RN onboarding features snippets order * updates Dart onboarding features snippets order * updates Flutter onboarding features snippets * updates Flutter onboarding features snippets * fixes Capacitor onboarding features snippets * fix new Flutter platform links after merging * update Flutter platform links in Mobile Vitals * updates Expo onboarding features snippets
1 parent 4d55b40 commit 44fea31

File tree

8 files changed

+79
-67
lines changed

8 files changed

+79
-67
lines changed

docs/platforms/apple/common/index.mdx

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ To capture all errors, initialize the SDK as soon as possible, such as in your `
8787

8888
<PlatformSection notSupported={["apple.tvos", "apple.watchos", "apple.visionos"]}>
8989

90-
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12", "profiling": "14-24"}}
90+
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}}
9191
import Sentry
9292

9393
func application(_ application: UIApplication,
@@ -97,13 +97,13 @@ func application(_ application: UIApplication,
9797
options.dsn = "___PUBLIC_DSN___"
9898
options.debug = true // Enabled debug when first installing is always helpful
9999

100-
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
101-
// We recommend adjusting this value in production.
102-
options.tracesSampleRate = 1.0
103-
104100
// Adds IP for users.
105101
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
106102
options.sendDefaultPii = true
103+
104+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
105+
// We recommend adjusting this value in production.
106+
options.tracesSampleRate = 1.0
107107
}
108108

109109
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
@@ -121,7 +121,7 @@ func application(_ application: UIApplication,
121121
}
122122
```
123123

124-
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11", "profiling": "13-23"}}
124+
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "17-27"}}
125125
@import Sentry;
126126

127127
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@@ -130,13 +130,13 @@ func application(_ application: UIApplication,
130130
options.dsn = @"___PUBLIC_DSN___";
131131
options.debug = YES; // Enabled debug when first installing is always helpful
132132

133-
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
134-
// We recommend adjusting this value in production.
135-
options.tracesSampleRate = @1.0;
136-
137133
// Adds IP for users.
138134
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
139135
options.sendDefaultPii = YES
136+
137+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
138+
// We recommend adjusting this value in production.
139+
options.tracesSampleRate = @1.0;
140140
}];
141141

142142
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
@@ -154,7 +154,7 @@ func application(_ application: UIApplication,
154154
}
155155
```
156156

157-
```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "9-12", "profiling": "13-16"}}
157+
```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}}
158158
import Sentry
159159

160160
@main
@@ -164,26 +164,33 @@ struct SwiftUIApp: App {
164164
options.dsn = "___PUBLIC_DSN___"
165165
options.debug = true // Enabled debug when first installing is always helpful
166166

167+
// Adds IP for users.
168+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
169+
options.sendDefaultPii = true
170+
167171
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
168172
// We recommend adjusting this value in production.
169173
options.tracesSampleRate = 1.0
174+
}
170175

171-
// Sample rate for profiling, applied on top of TracesSampleRate.
172-
// We recommend adjusting this value in production.
173-
options.profilesSampleRate = 1.0
176+
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
177+
SentrySDK.startProfiler()
174178

175-
// Adds IP for users.
176-
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
177-
options.sendDefaultPii = true
178-
}
179+
//
180+
// ...anything here will be profiled...
181+
//
182+
183+
// Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
184+
// your application until the process exits, the app goes to the background, or stopProfiling is called.
185+
SentrySDK.stopProfiler()
179186
}
180187
}
181188
```
182189
</PlatformSection>
183190

184191
<PlatformSection notSupported={["apple.ios", "apple.macos"]}>
185192

186-
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12"}}
193+
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16"}}
187194
import Sentry
188195

189196
func application(_ application: UIApplication,
@@ -193,20 +200,20 @@ func application(_ application: UIApplication,
193200
options.dsn = "___PUBLIC_DSN___"
194201
options.debug = true // Enabled debug when first installing is always helpful
195202

196-
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
197-
// We recommend adjusting this value in production.
198-
options.tracesSampleRate = 1.0
199-
200203
// Adds IP for users.
201204
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
202205
options.sendDefaultPii = true
206+
207+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
208+
// We recommend adjusting this value in production.
209+
options.tracesSampleRate = 1.0
203210
}
204211

205212
return true
206213
}
207214
```
208215

209-
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11"}}
216+
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15"}}
210217
@import Sentry;
211218

212219
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@@ -215,20 +222,20 @@ func application(_ application: UIApplication,
215222
options.dsn = @"___PUBLIC_DSN___";
216223
options.debug = YES; // Enabled debug when first installing is always helpful
217224

218-
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
219-
// We recommend adjusting this value in production.
220-
options.tracesSampleRate = @1.0;
221-
222225
// Adds IP for users.
223226
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
224227
options.sendDefaultPii = YES
228+
229+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
230+
// We recommend adjusting this value in production.
231+
options.tracesSampleRate = @1.0;
225232
}];
226233

227234
return YES;
228235
}
229236
```
230237

231-
```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "9-12"}}
238+
```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16"}}
232239
import Sentry
233240

234241
@main
@@ -238,13 +245,13 @@ struct SwiftUIApp: App {
238245
options.dsn = "___PUBLIC_DSN___"
239246
options.debug = true // Enabled debug when first installing is always helpful
240247

241-
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
242-
// We recommend adjusting this value in production.
243-
options.tracesSampleRate = 1.0
244-
245248
// Adds IP for users.
246249
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
247250
options.sendDefaultPii = true
251+
252+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
253+
// We recommend adjusting this value in production.
254+
options.tracesSampleRate = 1.0
248255
}
249256
}
250257
}

docs/platforms/dart/guides/flutter/index.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ brew install getsentry/tools/sentry-wizard && sentry-wizard -i flutter
4747
npx @sentry/wizard@latest -i flutter
4848
```
4949

50-
[Sentry Wizard](https://github.com/getsentry/sentry-wizard) will patch your project accordingly, though you can [set up manually](/platforms/dart/guides/flutter/manual-setup/) if you prefer. You only need to patch the project once. Then you can add the patched files to your version control system.
51-
50+
[Sentry Wizard](https://github.com/getsentry/sentry-wizard) will patch your project accordingly, though you can [set up manually](/platforms/dart/guides/flutter/manual-setup/) if you prefer. You only need to patch the project once. Then you can add the patched files to your version control system.
5251

5352
<Expandable title="The following tasks will be performed by the Sentry Wizard">
5453

@@ -62,24 +61,24 @@ npx @sentry/wizard@latest -i flutter
6261

6362
Configuration should happen as early as possible in your application's lifecycle.
6463

65-
```dart {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}}
64+
```dart {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}}
6665
import 'package:flutter/widgets.dart';
6766
import 'package:sentry_flutter/sentry_flutter.dart';
6867
6968
Future<void> main() async {
7069
await SentryFlutter.init(
7170
(options) {
7271
options.dsn = '___PUBLIC_DSN___';
72+
// Adds request headers and IP for users,
73+
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
74+
options.sendDefaultPii = true;
7375
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
7476
// We recommend adjusting this value in production.
7577
options.tracesSampleRate = 1.0;
7678
// The sampling rate for profiling is relative to tracesSampleRate
7779
// Setting to 1.0 will profile 100% of sampled transactions:
7880
// Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0
7981
options.profilesSampleRate = 1.0;
80-
// Adds request headers and IP for users,
81-
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
82-
options.sendDefaultPii = true;
8382
},
8483
appRunner: () => runApp(
8584
SentryWidget(
@@ -93,7 +92,7 @@ Future<void> main() async {
9392
}
9493
```
9594

96-
```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "16-18", "profiling": "19-22"}}
95+
```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "19-21", "profiling": "22-25"}}
9796
import 'package:flutter/widgets.dart';
9897
import 'package:sentry_flutter/sentry_flutter.dart';
9998
@@ -109,6 +108,9 @@ Future<void> main() async {
109108
await SentryFlutter.init(
110109
(options) {
111110
options.dsn = '___PUBLIC_DSN___';
111+
// Adds request headers and IP for users,
112+
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
113+
options.sendDefaultPii = true;
112114
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
113115
// We recommend adjusting this value in production.
114116
options.tracesSampleRate = 1.0;

docs/platforms/dart/guides/flutter/manual-setup.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ dependencies:
2727
2828
Configuration should happen as early as possible in your application's lifecycle.
2929
30-
```dart {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}}
30+
```dart {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}}
3131
import 'package:flutter/widgets.dart';
3232
import 'package:sentry_flutter/sentry_flutter.dart';
3333

3434
Future<void> main() async {
3535
await SentryFlutter.init(
3636
(options) {
3737
options.dsn = '___PUBLIC_DSN___';
38+
// Adds request headers and IP for users,
39+
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
40+
options.sendDefaultPii = true;
3841
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
3942
// We recommend adjusting this value in production.
4043
options.tracesSampleRate = 1.0;
4144
// The sampling rate for profiling is relative to tracesSampleRate
4245
// Setting to 1.0 will profile 100% of sampled transactions:
4346
// Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0
4447
options.profilesSampleRate = 1.0;
45-
// Adds request headers and IP for users,
46-
// visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info
47-
options.sendDefaultPii = true;
4848
},
4949
appRunner: () => runApp(
5050
SentryWidget(
@@ -58,7 +58,7 @@ Future<void> main() async {
5858
}
5959
```
6060

61-
```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "16-18", "profiling": "19-22"}}
61+
```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "19-21", "profiling": "22-25"}}
6262
import 'package:flutter/widgets.dart';
6363
import 'package:sentry_flutter/sentry_flutter.dart';
6464
@@ -74,6 +74,9 @@ Future<void> main() async {
7474
await SentryFlutter.init(
7575
(options) {
7676
options.dsn = '___PUBLIC_DSN___';
77+
// Adds request headers and IP for users,
78+
// visit: https://docs.sentry.io/platforms/dart/guides//data-management/data-collected/ for more info
79+
options.sendDefaultPii = true;
7780
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
7881
// We recommend adjusting this value in production.
7982
options.tracesSampleRate = 1.0;

docs/platforms/dart/index.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
2525

2626
<Alert>
2727

28-
Sentry provides a dedicated [Flutter SDK](/platforms/dart/guides/flutter) as well.
28+
Sentry provides a dedicated [Flutter SDK](/platforms/dart/guides/flutter) as well.
2929

3030
</Alert>
3131

@@ -51,18 +51,18 @@ dependencies:
5151
To capture all errors, initialize the Sentry Dart SDK as soon as possible.
5252
5353
54-
```dart {"onboardingOptions": {"performance": "6-8"}}
54+
```dart {"onboardingOptions": {"performance": "9-11"}}
5555
import 'package:sentry/sentry.dart';
5656

5757
Future<void> main() async {
5858
await Sentry.init((options) {
5959
options.dsn = '___PUBLIC_DSN___';
60-
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
61-
// We recommend adjusting this value in production.
62-
options.tracesSampleRate = 1.0;
6360
// Adds request headers and IP for users,
6461
// visit: https://docs.sentry.io/platforms/dart/data-management/data-collected/ for more info
6562
options.sendDefaultPii = true;
63+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
64+
// We recommend adjusting this value in production.
65+
options.tracesSampleRate = 1.0;
6666
});
6767

6868
// you can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and

docs/platforms/react-native/index.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ If you're using Expo, [read our docs](/platforms/react-native/manual-setup/expo/
6464

6565
To capture all errors, initialize the Sentry React Native SDK as soon as possible.
6666

67-
```javascript {filename:App.js} {"onboardingOptions": {"performance": "5-9", "profiling": "10-12"}}
67+
```javascript {filename:App.js} {"onboardingOptions": {"performance": "8-12", "profiling": "13-15"}}
6868
import * as Sentry from "@sentry/react-native";
6969

7070
Sentry.init({
7171
dsn: "___PUBLIC_DSN___",
72+
// Adds more context data to events (IP address, cookies, user, etc.)
73+
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
74+
sendDefaultPii: true,
7275
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
7376
// We recommend adjusting this value in production.
7477
// Learn more at
@@ -77,9 +80,6 @@ Sentry.init({
7780
// profilesSampleRate is relative to tracesSampleRate.
7881
// Here, we'll capture profiles for 100% of transactions.
7982
profilesSampleRate: 1.0,
80-
// Adds more context data to events (IP address, cookies, user, etc.)
81-
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
82-
sendDefaultPii: true,
8383
});
8484
```
8585

docs/platforms/react-native/manual-setup/expo.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@ pnpm add @sentry/react-native
6666

6767
Import the `@sentry/react-native` package and call `init` with your DSN:
6868

69-
```javascript {tabTitle:App.js or app/_layout.js} {"onboardingOptions": {"performance": "6-10", "profiling": "11-13"}}
69+
```javascript {tabTitle:App.js or app/_layout.js} {"onboardingOptions": {"performance": "9-13", "profiling": "14-16"}}
7070
import { Text, View } from "react-native";
7171
import * as Sentry from "@sentry/react-native";
7272

7373
Sentry.init({
7474
dsn: "___PUBLIC_DSN___",
75+
// Adds more context data to events (IP address, cookies, user, etc.)
76+
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
77+
sendDefaultPii: true,
7578
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
7679
// We recommend adjusting this value in production.
7780
// Learn more at
@@ -80,9 +83,6 @@ Sentry.init({
8083
// profilesSampleRate is relative to tracesSampleRate.
8184
// Here, we'll capture profiles for 100% of transactions.
8285
profilesSampleRate: 1.0,
83-
// Adds more context data to events (IP address, cookies, user, etc.)
84-
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
85-
sendDefaultPii: true,
8686
});
8787

8888
function App() {

0 commit comments

Comments
 (0)