From 44fea31bfbfbfbd851e5b044f7681cc44e337e5b Mon Sep 17 00:00:00 2001 From: Karl Heinz Struggl Date: Fri, 7 Mar 2025 06:06:11 -0800 Subject: [PATCH] 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 --- docs/platforms/apple/common/index.mdx | 73 ++++++++++--------- docs/platforms/dart/guides/flutter/index.mdx | 16 ++-- .../dart/guides/flutter/manual-setup.mdx | 13 ++-- docs/platforms/dart/index.mdx | 10 +-- docs/platforms/react-native/index.mdx | 8 +- .../react-native/manual-setup/expo.mdx | 8 +- .../insights/mobile/mobile-vitals/index.mdx | 10 +-- .../javascript.capacitor.mdx | 8 +- 8 files changed, 79 insertions(+), 67 deletions(-) diff --git a/docs/platforms/apple/common/index.mdx b/docs/platforms/apple/common/index.mdx index 26fe0ea7bbb30..3caf1f19e63c9 100644 --- a/docs/platforms/apple/common/index.mdx +++ b/docs/platforms/apple/common/index.mdx @@ -87,7 +87,7 @@ To capture all errors, initialize the SDK as soon as possible, such as in your ` -```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12", "profiling": "14-24"}} +```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}} import Sentry func application(_ application: UIApplication, @@ -97,13 +97,13 @@ func application(_ application: UIApplication, options.dsn = "___PUBLIC_DSN___" options.debug = true // Enabled debug when first installing is always helpful - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. - // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0 - // Adds IP for users. // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = true + + // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // We recommend adjusting this value in production. + options.tracesSampleRate = 1.0 } // Manually call startProfiler and stopProfiler to profile any code that runs in between. @@ -121,7 +121,7 @@ func application(_ application: UIApplication, } ``` -```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11", "profiling": "13-23"}} +```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15", "profiling": "17-27"}} @import Sentry; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -130,13 +130,13 @@ func application(_ application: UIApplication, options.dsn = @"___PUBLIC_DSN___"; options.debug = YES; // Enabled debug when first installing is always helpful - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. - // We recommend adjusting this value in production. - options.tracesSampleRate = @1.0; - // Adds IP for users. // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = YES + + // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // We recommend adjusting this value in production. + options.tracesSampleRate = @1.0; }]; // Manually call startProfiler and stopProfiler to profile any code that runs in between. @@ -154,7 +154,7 @@ func application(_ application: UIApplication, } ``` -```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "9-12", "profiling": "13-16"}} +```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16", "profiling": "18-28"}} import Sentry @main @@ -164,18 +164,25 @@ struct SwiftUIApp: App { options.dsn = "___PUBLIC_DSN___" options.debug = true // Enabled debug when first installing is always helpful + // Adds IP for users. + // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ + options.sendDefaultPii = true + // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0 + } - // Sample rate for profiling, applied on top of TracesSampleRate. - // We recommend adjusting this value in production. - options.profilesSampleRate = 1.0 + // Manually call startProfiler and stopProfiler to profile any code that runs in between. + SentrySDK.startProfiler() - // Adds IP for users. - // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ - options.sendDefaultPii = true - } + // + // ...anything here will be profiled... + // + + // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling + // your application until the process exits, the app goes to the background, or stopProfiling is called. + SentrySDK.stopProfiler() } } ``` @@ -183,7 +190,7 @@ struct SwiftUIApp: App { -```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12"}} +```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "13-16"}} import Sentry func application(_ application: UIApplication, @@ -193,20 +200,20 @@ func application(_ application: UIApplication, options.dsn = "___PUBLIC_DSN___" options.debug = true // Enabled debug when first installing is always helpful - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. - // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0 - // Adds IP for users. // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = true + + // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // We recommend adjusting this value in production. + options.tracesSampleRate = 1.0 } return true } ``` -```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11"}} +```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "12-15"}} @import Sentry; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -215,20 +222,20 @@ func application(_ application: UIApplication, options.dsn = @"___PUBLIC_DSN___"; options.debug = YES; // Enabled debug when first installing is always helpful - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. - // We recommend adjusting this value in production. - options.tracesSampleRate = @1.0; - // Adds IP for users. // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = YES + + // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // We recommend adjusting this value in production. + options.tracesSampleRate = @1.0; }]; return YES; } ``` -```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "9-12"}} +```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "13-16"}} import Sentry @main @@ -238,13 +245,13 @@ struct SwiftUIApp: App { options.dsn = "___PUBLIC_DSN___" options.debug = true // Enabled debug when first installing is always helpful - // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. - // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0 - // Adds IP for users. // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/ options.sendDefaultPii = true + + // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. + // We recommend adjusting this value in production. + options.tracesSampleRate = 1.0 } } } diff --git a/docs/platforms/dart/guides/flutter/index.mdx b/docs/platforms/dart/guides/flutter/index.mdx index 131e25398cfc8..b15739cc88cf0 100644 --- a/docs/platforms/dart/guides/flutter/index.mdx +++ b/docs/platforms/dart/guides/flutter/index.mdx @@ -47,8 +47,7 @@ brew install getsentry/tools/sentry-wizard && sentry-wizard -i flutter npx @sentry/wizard@latest -i flutter ``` -[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. - +[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. @@ -62,7 +61,7 @@ npx @sentry/wizard@latest -i flutter Configuration should happen as early as possible in your application's lifecycle. -```dart {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}} +```dart {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}} import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -70,6 +69,9 @@ Future main() async { await SentryFlutter.init( (options) { options.dsn = '___PUBLIC_DSN___'; + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info + options.sendDefaultPii = true; // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0; @@ -77,9 +79,6 @@ Future main() async { // Setting to 1.0 will profile 100% of sampled transactions: // Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0 options.profilesSampleRate = 1.0; - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info - options.sendDefaultPii = true; }, appRunner: () => runApp( SentryWidget( @@ -93,7 +92,7 @@ Future main() async { } ``` -```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "16-18", "profiling": "19-22"}} +```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "19-21", "profiling": "22-25"}} import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -109,6 +108,9 @@ Future main() async { await SentryFlutter.init( (options) { options.dsn = '___PUBLIC_DSN___'; + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info + options.sendDefaultPii = true; // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0; diff --git a/docs/platforms/dart/guides/flutter/manual-setup.mdx b/docs/platforms/dart/guides/flutter/manual-setup.mdx index 33c9450fb3338..62435c28aa051 100644 --- a/docs/platforms/dart/guides/flutter/manual-setup.mdx +++ b/docs/platforms/dart/guides/flutter/manual-setup.mdx @@ -27,7 +27,7 @@ dependencies: Configuration should happen as early as possible in your application's lifecycle. -```dart {"onboardingOptions": {"performance": "8-10", "profiling": "11-14"}} +```dart {"onboardingOptions": {"performance": "11-13", "profiling": "14-17"}} import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -35,6 +35,9 @@ Future main() async { await SentryFlutter.init( (options) { options.dsn = '___PUBLIC_DSN___'; + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info + options.sendDefaultPii = true; // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0; @@ -42,9 +45,6 @@ Future main() async { // Setting to 1.0 will profile 100% of sampled transactions: // Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0 options.profilesSampleRate = 1.0; - // Adds request headers and IP for users, - // visit: https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ for more info - options.sendDefaultPii = true; }, appRunner: () => runApp( SentryWidget( @@ -58,7 +58,7 @@ Future main() async { } ``` -```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "16-18", "profiling": "19-22"}} +```dart {tabTitle:With custom zone} {"onboardingOptions": {"performance": "19-21", "profiling": "22-25"}} import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -74,6 +74,9 @@ Future main() async { await SentryFlutter.init( (options) { options.dsn = '___PUBLIC_DSN___'; + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/dart/guides//data-management/data-collected/ for more info + options.sendDefaultPii = true; // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0; diff --git a/docs/platforms/dart/index.mdx b/docs/platforms/dart/index.mdx index 3a2abfca1dfcd..c8b5f5e237b2a 100644 --- a/docs/platforms/dart/index.mdx +++ b/docs/platforms/dart/index.mdx @@ -25,7 +25,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori -Sentry provides a dedicated [Flutter SDK](/platforms/dart/guides/flutter) as well. +Sentry provides a dedicated [Flutter SDK](/platforms/dart/guides/flutter) as well. @@ -51,18 +51,18 @@ dependencies: To capture all errors, initialize the Sentry Dart SDK as soon as possible. -```dart {"onboardingOptions": {"performance": "6-8"}} +```dart {"onboardingOptions": {"performance": "9-11"}} import 'package:sentry/sentry.dart'; Future main() async { await Sentry.init((options) { options.dsn = '___PUBLIC_DSN___'; - // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. - // We recommend adjusting this value in production. - options.tracesSampleRate = 1.0; // Adds request headers and IP for users, // visit: https://docs.sentry.io/platforms/dart/data-management/data-collected/ for more info options.sendDefaultPii = true; + // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. + // We recommend adjusting this value in production. + options.tracesSampleRate = 1.0; }); // you can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and diff --git a/docs/platforms/react-native/index.mdx b/docs/platforms/react-native/index.mdx index 3afe653c36eff..2f94111a9efc4 100644 --- a/docs/platforms/react-native/index.mdx +++ b/docs/platforms/react-native/index.mdx @@ -64,11 +64,14 @@ If you're using Expo, [read our docs](/platforms/react-native/manual-setup/expo/ To capture all errors, initialize the Sentry React Native SDK as soon as possible. -```javascript {filename:App.js} {"onboardingOptions": {"performance": "5-9", "profiling": "10-12"}} +```javascript {filename:App.js} {"onboardingOptions": {"performance": "8-12", "profiling": "13-15"}} import * as Sentry from "@sentry/react-native"; Sentry.init({ dsn: "___PUBLIC_DSN___", + // Adds more context data to events (IP address, cookies, user, etc.) + // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/ + sendDefaultPii: true, // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. // Learn more at @@ -77,9 +80,6 @@ Sentry.init({ // profilesSampleRate is relative to tracesSampleRate. // Here, we'll capture profiles for 100% of transactions. profilesSampleRate: 1.0, - // Adds more context data to events (IP address, cookies, user, etc.) - // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/ - sendDefaultPii: true, }); ``` diff --git a/docs/platforms/react-native/manual-setup/expo.mdx b/docs/platforms/react-native/manual-setup/expo.mdx index bfd77fd573bed..498ebc49cb010 100644 --- a/docs/platforms/react-native/manual-setup/expo.mdx +++ b/docs/platforms/react-native/manual-setup/expo.mdx @@ -66,12 +66,15 @@ pnpm add @sentry/react-native Import the `@sentry/react-native` package and call `init` with your DSN: -```javascript {tabTitle:App.js or app/_layout.js} {"onboardingOptions": {"performance": "6-10", "profiling": "11-13"}} +```javascript {tabTitle:App.js or app/_layout.js} {"onboardingOptions": {"performance": "9-13", "profiling": "14-16"}} import { Text, View } from "react-native"; import * as Sentry from "@sentry/react-native"; Sentry.init({ dsn: "___PUBLIC_DSN___", + // Adds more context data to events (IP address, cookies, user, etc.) + // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/ + sendDefaultPii: true, // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. // Learn more at @@ -80,9 +83,6 @@ Sentry.init({ // profilesSampleRate is relative to tracesSampleRate. // Here, we'll capture profiles for 100% of transactions. profilesSampleRate: 1.0, - // Adds more context data to events (IP address, cookies, user, etc.) - // For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/ - sendDefaultPii: true, }); function App() { diff --git a/docs/product/insights/mobile/mobile-vitals/index.mdx b/docs/product/insights/mobile/mobile-vitals/index.mdx index c20fae20a9686..c8f3255e5afae 100644 --- a/docs/product/insights/mobile/mobile-vitals/index.mdx +++ b/docs/product/insights/mobile/mobile-vitals/index.mdx @@ -16,7 +16,7 @@ The definitions of cold start and warm start change slightly depending on the op - [Android](/platforms/android/tracing/instrumentation/automatic-instrumentation/#app-start-instrumentation) - [Apple](/platforms/apple/guides/ios/tracing/instrumentation/automatic-instrumentation/#app-start-tracking) -- [Flutter](/platforms/flutter/tracing/instrumentation/automatic-instrumentation/#app-start-instrumentation) +- [Flutter](/platforms/dart/guides/flutter/tracing/instrumentation/automatic-instrumentation/#app-start-instrumentation) - [React Native](/platforms/react-native/tracing/instrumentation/automatic-instrumentation/#app-start-instrumentation) In the example below, the detail view of a transaction displays the warm start measurement in the right sidebar. @@ -46,7 +46,7 @@ You can track slow and frozen frames for: - [Android](/platforms/android/tracing/instrumentation/automatic-instrumentation/#slow-and-frozen-frames) - [Apple](/platforms/apple/guides/ios/tracing/instrumentation/automatic-instrumentation/#slow-and-frozen-frames) -- [Flutter](/platforms/flutter/tracing/instrumentation/automatic-instrumentation/#slow-and-frozen-frames) +- [Flutter](/platforms/dart/guides/flutter/tracing/instrumentation/automatic-instrumentation/#slow-and-frozen-frames) - [React Native](/platforms/react-native/tracing/instrumentation/automatic-instrumentation/#slow-and-frozen-frames) ## Frames Delay @@ -56,7 +56,7 @@ Frames Delay is the user-perceived total delayed duration of rendered frames. Fo You can track frames delay on the following platforms: - [Android](/platforms/android/tracing/instrumentation/perf-v2/#frames-delay) - [Apple, as part of slow and frozen frames](/platforms/apple/guides/ios/tracing/instrumentation/automatic-instrumentation/#slow-and-frozen-frames) -- [Flutter](/platforms/flutter/integrations/slow-and-frozen-frames-instrumentation/) +- [Flutter](/platforms/dart/guides/flutter/integrations/slow-and-frozen-frames-instrumentation/) ## Time to Initial Display and Time to Full Display @@ -74,14 +74,14 @@ You can track time to initial display for: - [Android](/platforms/android/tracing/instrumentation/automatic-instrumentation/#time-to-initial-display) - [Apple](/platforms/apple/tracing/instrumentation/automatic-instrumentation/#time-to-initial-display) -- [Flutter](/platforms/flutter/integrations/routing-instrumentation/#time-to-initial-display) +- [Flutter](/platforms/dart/guides/flutter/integrations/routing-instrumentation/#time-to-initial-display) - [React Native](/platforms/react-native/performance/instrumentation/time-to-display/#automatic-time-to-initial-display-for-react-navigation) You can track time to full display for: - [Android](/platforms/android/tracing/instrumentation/automatic-instrumentation/#time-to-full-display) - [Apple](/platforms/apple/tracing/instrumentation/automatic-instrumentation/#time-to-full-display) -- [Flutter](/platforms/flutter/integrations/routing-instrumentation/#time-to-full-display) +- [Flutter](/platforms/dart/guides/flutter/integrations/routing-instrumentation/#time-to-full-display) - [React Native](/platforms/react-native/performance/instrumentation/time-to-display/#time-to-full-display) To get more insight into the performance of your time to initial display and time to full display metrics, use the [Screen Loads](/product/insights/mobile/mobile-vitals/screen-loads/) feature. diff --git a/platform-includes/getting-started-config/javascript.capacitor.mdx b/platform-includes/getting-started-config/javascript.capacitor.mdx index 582ed459b34f7..f7ce90822f5b4 100644 --- a/platform-includes/getting-started-config/javascript.capacitor.mdx +++ b/platform-includes/getting-started-config/javascript.capacitor.mdx @@ -1,7 +1,7 @@ Then forward the `init` method from the sibling Sentry SDK for the framework you use, such as Angular in this example: -```typescript {tabTitle: Angular 14+} {filename: app.module.ts} {"onboardingOptions": {"performance": "13-16, 21-28, 46-55", "session-replay": "17-19, 29-33"}} +```typescript {tabTitle: Angular 14+} {filename: app.module.ts} {"onboardingOptions": {"performance": "13-16, 21-30, 50-59", "session-replay": "17-19, 31-37"}} import * as Sentry from "@sentry/capacitor"; import * as SentryAngular from "@sentry/angular"; @@ -65,7 +65,7 @@ Sentry.init( }) ``` -```typescript {tabTitle: Angular 12, 13} {filename: app.module.ts} {"onboardingOptions": {"performance": "14-17, 22-29, 47-56", "session-replay": "18-20, 30-34"}} +```typescript {tabTitle: Angular 12, 13} {filename: app.module.ts} {"onboardingOptions": {"performance": "14-17, 22-31, 51-60", "session-replay": "18-20, 32-38"}} // Requires @sentry/capacitor V0. import * as Sentry from "@sentry/capacitor"; import * as SentryAngular from "@sentry/angular-ivy"; @@ -130,7 +130,7 @@ Sentry.init( }) ``` -```typescript {tabTitle: React} {filename: index.tsx} {"onboardingOptions": {"performance": "13-16, 21-28, 46-55", "session-replay": "17-19, 29-33"}} +```typescript {tabTitle: React} {filename: index.tsx} {"onboardingOptions": {"performance": "13-16, 21-30, 46-55", "session-replay": "17-19, 29-37"}} import * as Sentry from "@sentry/capacitor"; import * as SentryReact from "@sentry/react"; @@ -174,7 +174,7 @@ Sentry.init( ); ``` -```typescript {tabTitle: Vue} {filename: main.ts} {"onboardingOptions": {"performance": "17-20, 25-32, 50-59", "session-replay": "21-23, 33-37 "}} +```typescript {tabTitle: Vue} {filename: main.ts} {"onboardingOptions": {"performance": "17-20, 25-34, 50-59", "session-replay": "21-23, 33-41"}} import * as Sentry from "@sentry/capacitor"; import * as SentryVue from "@sentry/vue"; import { createApp } from 'vue'