From 245aae717a4c8c3e48946fcdb0d17f29c95e7ed2 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2026 21:40:01 +0000 Subject: [PATCH 1/5] feat(docs): Apply new quick start template to Dart and Flutter quick start guides Co-Authored-By: Shannon Anahata --- docs/platforms/dart/common/index.mdx | 121 +++++++++++---- docs/platforms/dart/guides/flutter/index.mdx | 154 +++++++++++++++---- 2 files changed, 217 insertions(+), 58 deletions(-) diff --git a/docs/platforms/dart/common/index.mdx b/docs/platforms/dart/common/index.mdx index a15ba542b8fb8..19d6671ae13be 100644 --- a/docs/platforms/dart/common/index.mdx +++ b/docs/platforms/dart/common/index.mdx @@ -1,6 +1,6 @@ --- title: Dart -description: Learn how to set up Sentry in your Dart app, capture your first errors and traces, and view them in Sentry. +description: Learn how to set up Sentry in your Dart app, capture your first events and traces, and view them in Sentry. caseStyle: camelCase supportLevel: production sdk: sentry.dart @@ -33,9 +33,8 @@ dependencies: ## Configure -Choose the features you want to configure, and this guide will show you how: - - +**Error Monitoring** starts working as soon as you call `Sentry.init()`. **Logs** and **Application Metrics** need no extra configuration in the current SDK, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). +This guide also enables **Tracing**. @@ -45,38 +44,107 @@ Configuration should happen as **early as possible** in your application's lifec Import and initialize the SDK in your app's entry point: +The snippet also turns on: + +- Tracing: via `tracesSampleRate` +- Additional user and request data: via `sendDefaultPii` + +Don't need a feature? Remove its integration and options from the snippet. + + + + ```dart import 'package:sentry/sentry.dart'; Future main() async { await Sentry.init((options) { options.dsn = '___PUBLIC_DSN___'; - // Adds request headers and IP for users, for more info visit: - // https://docs.sentry.io/platforms/dart/data-management/data-collected/ + + // Adds request headers and IP to events. options.sendDefaultPii = true; - // ___PRODUCT_OPTION_START___ performance - // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. - // We recommend adjusting this value in production. + + // Enables Tracing. + // Set to 1.0 to capture 100% of spans for tracing. + // We recommend reducing this value in production. options.tracesSampleRate = 1.0; - // ___PRODUCT_OPTION_END___ performance }); - // you can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and - // SENTRY_ENVIRONMENT via Dart environment variable (--dart-define) + // You can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and + // SENTRY_ENVIRONMENT via Dart environment variables (--dart-define). } ``` + + + + +## Send Logs + + + + + +Use `Sentry.logger` to send structured logs at different levels. You can add attributes to make logs easier to search and filter. + +If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. + +See Set Up Logs for all available logging methods and message formatting. + + + + +```dart +Sentry.logger.info('Order completed', attributes: { + 'order_id': SentryAttribute.string('12345'), + 'total': SentryAttribute.double(99.99), +}); + +Sentry.logger.warn('Slow operation detected'); +Sentry.logger.error('Validation failed'); +``` + + + + + +## Send Application Metrics + + + + + +Use `Sentry.metrics` to send counters, gauges, and distributions from your app. Add attributes to filter and group metrics in Sentry. + +See Set Up Metrics for metric types, attributes, and configuration options. + + + + +```dart +Sentry.metrics.count('checkout.failed', 1); +Sentry.metrics.gauge('queue.depth', 42); +Sentry.metrics.distribution('api_latency', 187); +``` + + + + + ## Verify Your Setup Let's test your setup and confirm that data reaches your Sentry project. -### Issues + + + -To verify that Sentry captures errors and creates issues in your Sentry project, add this intentional error to your application: +Add this to your async entry point after `Sentry.init()` to trigger and capture a test error: -```dart -import 'package:sentry/sentry.dart'; + + +```dart try { throw StateError('Sentry Test Error'); } catch (exception, stackTrace) { @@ -87,15 +155,9 @@ try { } ``` - - - - - - - - - + + + ### View Captured Data in Sentry @@ -105,16 +167,11 @@ Now, head over to your project on [Sentry.io](https://sentry.io) to view the col ## Next Steps -At this point, you should have integrated Sentry into your Dart application and should already be sending data to your Sentry project. - -Now's a good time to customize your setup and look into more advanced topics. -Our next recommended steps for you are: +At this point, you should have integrated Sentry into your Dart application. Here's what to explore next: - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup -- Continue to customize your configuration - Learn more about manually capturing errors or messages -- Learn about the features of Sentry's Dart SDK -- Add performance instrumentation to your app +- Add performance instrumentation to your app diff --git a/docs/platforms/dart/guides/flutter/index.mdx b/docs/platforms/dart/guides/flutter/index.mdx index 95d9486c7c955..87d628480f706 100644 --- a/docs/platforms/dart/guides/flutter/index.mdx +++ b/docs/platforms/dart/guides/flutter/index.mdx @@ -1,6 +1,6 @@ --- title: Flutter -description: Learn how to set up Sentry in your Flutter app, capture your first errors and traces, and view them in Sentry. +description: Learn how to set up Sentry in your Flutter app, capture your first events and traces, and view them in Sentry. caseStyle: camelCase supportLevel: production sdk: sentry.dart.flutter @@ -77,37 +77,145 @@ If you prefer, you can also [set up the SDK manually](/platforms/dart/guides/flu -The wizard will prompt you to enable optional features. Select the same options here so this guide can show you how to verify them: +## Configure - +**Error Monitoring** starts working as soon as you call `SentryFlutter.init()`. **Logs** and **Application Metrics** need no extra configuration in the current SDK, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). +This guide also enables **Tracing** and **Session Replay**. Collect **User Feedback** with the Flutter SDK's feedback form or API. -## Verify Your Setup +### Initialize the Sentry SDK -Let's test your setup and confirm that data reaches your Sentry project. +Configuration should happen as **early as possible** in your application's lifecycle. + + + + + +Import and initialize the SDK in your app's `main` function: + +The snippet also turns on: + +- Tracing: via `tracesSampleRate` +- Session Replay: via `SentryWidget`, sampled with `sessionSampleRate` and `onErrorSampleRate` +- Additional user and request data: via `sendDefaultPii` + +Don't need a feature? Remove its integration and options from the snippet. + + + + +```dart +import 'package:flutter/widgets.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; -### Issues +Future main() async { + await SentryFlutter.init( + (options) { + options.dsn = '___PUBLIC_DSN___'; -The wizard added a sample exception to `main.dart` that is captured when the app starts. Run your app to send it to Sentry: + // Adds request headers and IP to events. + options.sendDefaultPii = true; -```bash -flutter run + // Enables Tracing. + // Set to 1.0 to capture 100% of spans for tracing. + // We recommend reducing this value in production. + options.tracesSampleRate = 1.0; + + // Capture replays for 10% of sessions and 100% of sessions with an error. + options.replay.sessionSampleRate = 0.1; + options.replay.onErrorSampleRate = 1.0; + }, + appRunner: () => runApp( + SentryWidget( + child: MyApp(), + ), + ), + ); + + // You can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and + // SENTRY_ENVIRONMENT via Dart environment variables (--dart-define). +} ``` -After you've confirmed the issue in Sentry, remove the sample exception from `main.dart` so it isn't captured on every launch. + + + + +## Send Logs + + + + + +Use `Sentry.logger` to send structured logs at different levels. You can add attributes to make logs easier to search and filter. - +If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. - +See Set Up Logs for all available logging methods and message formatting. + + + + +```dart +Sentry.logger.info('Order completed', attributes: { + 'order_id': SentryAttribute.string('12345'), + 'total': SentryAttribute.double(99.99), +}); + +Sentry.logger.warn('Slow operation detected'); +Sentry.logger.error('Validation failed'); +``` - + + + - +## Send Application Metrics - + + + + +Use `Sentry.metrics` to send counters, gauges, and distributions from your app. Add attributes to filter and group metrics in Sentry. + +See Set Up Metrics for metric types, attributes, and configuration options. + + + + +```dart +Sentry.metrics.count('checkout.failed', 1); +Sentry.metrics.gauge('queue.depth', 42); +Sentry.metrics.distribution('api_latency', 187, unit: 'millisecond'); +``` + + + + + +## Verify Your Setup + +Let's test your setup and confirm that data reaches your Sentry project. + + + + + +Add this to an async function after initializing Sentry to capture a test error: + + + + +```dart +Future sendTestError() async { + await Sentry.captureException(StateError('Sentry Test Error')); +} +``` + + + + ### View Captured Data in Sentry @@ -117,20 +225,14 @@ Now, head over to your project on [Sentry.io](https://sentry.io) to view the col ## Next Steps -At this point, you should have integrated Sentry into your Flutter application and should already be sending data to your Sentry project. - -Now's a good time to customize your setup and look into more advanced topics. -Our next recommended steps for you are: +At this point, you should have integrated Sentry into your Flutter application. Here's what to explore next: - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup -- Continue to customize your configuration -- Add readable stack traces to errors -- Learn about the features of Sentry's Flutter SDK -- Add performance instrumentation to your app +- Learn about Session Replay and its privacy controls +- Add performance instrumentation to your app -- If you encountered issues with the installation wizard, try setting up Sentry manually - Find various topics in Troubleshooting - [Get support](https://www.sentry.help/en/) From 5a90defa16786fd423ad0e812efacd946843d1d8 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2026 21:47:10 +0000 Subject: [PATCH 2/5] fix(docs): Keep Flutter wizard verify flow and manual setup link Co-Authored-By: Shannon Anahata --- docs/platforms/dart/guides/flutter/index.mdx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/platforms/dart/guides/flutter/index.mdx b/docs/platforms/dart/guides/flutter/index.mdx index 87d628480f706..22517dc69b575 100644 --- a/docs/platforms/dart/guides/flutter/index.mdx +++ b/docs/platforms/dart/guides/flutter/index.mdx @@ -86,7 +86,7 @@ This guide also enables **Tracing** and **Session Replay**. Collect **User Feedb ### Initialize the Sentry SDK -Configuration should happen as **early as possible** in your application's lifecycle. +The wizard patches `main.dart` with `SentryFlutter.init` and prompts you for optional features. Enable Tracing and Session Replay when prompted, or update `main.dart` to match this snippet. @@ -202,21 +202,21 @@ Let's test your setup and confirm that data reaches your Sentry project. -Add this to an async function after initializing Sentry to capture a test error: +The wizard added a sample exception to `main.dart` that is captured when the app starts. Run your app to send it to Sentry: -```dart -Future sendTestError() async { - await Sentry.captureException(StateError('Sentry Test Error')); -} +```bash +flutter run ``` +After you've confirmed the issue in Sentry, remove the sample exception from `main.dart` so it isn't captured on every launch. + ### View Captured Data in Sentry Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). @@ -233,6 +233,7 @@ At this point, you should have integrated Sentry into your Flutter application. +- If you encountered issues with the installation wizard, try setting up Sentry manually - Find various topics in Troubleshooting - [Get support](https://www.sentry.help/en/) From 71c0235ed6aa1fbfefa3973184d16789290c7c2b Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 15 Oct 2026 22:14:25 +0000 Subject: [PATCH 3/5] ref(docs): Remove SplitLayout wrappers from Dart and Flutter quick starts Co-Authored-By: Shannon Anahata --- docs/platforms/dart/common/index.mdx | 40 ------------------ docs/platforms/dart/guides/flutter/index.mdx | 44 -------------------- 2 files changed, 84 deletions(-) diff --git a/docs/platforms/dart/common/index.mdx b/docs/platforms/dart/common/index.mdx index 19d6671ae13be..f0a150a364956 100644 --- a/docs/platforms/dart/common/index.mdx +++ b/docs/platforms/dart/common/index.mdx @@ -51,9 +51,6 @@ The snippet also turns on: Don't need a feature? Remove its integration and options from the snippet. - - - ```dart import 'package:sentry/sentry.dart'; @@ -75,25 +72,14 @@ Future main() async { } ``` - - - - ## Send Logs - - - - Use `Sentry.logger` to send structured logs at different levels. You can add attributes to make logs easier to search and filter. If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. See Set Up Logs for all available logging methods and message formatting. - - - ```dart Sentry.logger.info('Order completed', attributes: { 'order_id': SentryAttribute.string('12345'), @@ -104,46 +90,24 @@ Sentry.logger.warn('Slow operation detected'); Sentry.logger.error('Validation failed'); ``` - - - - ## Send Application Metrics - - - - Use `Sentry.metrics` to send counters, gauges, and distributions from your app. Add attributes to filter and group metrics in Sentry. See Set Up Metrics for metric types, attributes, and configuration options. - - - ```dart Sentry.metrics.count('checkout.failed', 1); Sentry.metrics.gauge('queue.depth', 42); Sentry.metrics.distribution('api_latency', 187); ``` - - - - ## Verify Your Setup Let's test your setup and confirm that data reaches your Sentry project. - - - - Add this to your async entry point after `Sentry.init()` to trigger and capture a test error: - - - ```dart try { throw StateError('Sentry Test Error'); @@ -155,10 +119,6 @@ try { } ``` - - - - ### View Captured Data in Sentry Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). diff --git a/docs/platforms/dart/guides/flutter/index.mdx b/docs/platforms/dart/guides/flutter/index.mdx index 22517dc69b575..12f02c08e5240 100644 --- a/docs/platforms/dart/guides/flutter/index.mdx +++ b/docs/platforms/dart/guides/flutter/index.mdx @@ -88,10 +88,6 @@ This guide also enables **Tracing** and **Session Replay**. Collect **User Feedb The wizard patches `main.dart` with `SentryFlutter.init` and prompts you for optional features. Enable Tracing and Session Replay when prompted, or update `main.dart` to match this snippet. - - - - Import and initialize the SDK in your app's `main` function: The snippet also turns on: @@ -102,9 +98,6 @@ The snippet also turns on: Don't need a feature? Remove its integration and options from the snippet. - - - ```dart import 'package:flutter/widgets.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -138,25 +131,14 @@ Future main() async { } ``` - - - - ## Send Logs - - - - Use `Sentry.logger` to send structured logs at different levels. You can add attributes to make logs easier to search and filter. If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. See Set Up Logs for all available logging methods and message formatting. - - - ```dart Sentry.logger.info('Order completed', attributes: { 'order_id': SentryAttribute.string('12345'), @@ -167,54 +149,28 @@ Sentry.logger.warn('Slow operation detected'); Sentry.logger.error('Validation failed'); ``` - - - - ## Send Application Metrics - - - - Use `Sentry.metrics` to send counters, gauges, and distributions from your app. Add attributes to filter and group metrics in Sentry. See Set Up Metrics for metric types, attributes, and configuration options. - - - ```dart Sentry.metrics.count('checkout.failed', 1); Sentry.metrics.gauge('queue.depth', 42); Sentry.metrics.distribution('api_latency', 187, unit: 'millisecond'); ``` - - - - ## Verify Your Setup Let's test your setup and confirm that data reaches your Sentry project. - - - - The wizard added a sample exception to `main.dart` that is captured when the app starts. Run your app to send it to Sentry: - - - ```bash flutter run ``` - - - - After you've confirmed the issue in Sentry, remove the sample exception from `main.dart` so it isn't captured on every launch. ### View Captured Data in Sentry From 44c809f333d740e88ed3be4fc849f10d71cc1fa0 Mon Sep 17 00:00:00 2001 From: Shannon Anahata Date: Thu, 29 Oct 2026 11:17:26 -0700 Subject: [PATCH 4/5] fix(docs): Correct Dart and Flutter quick-start setup Align the quick starts with SDK v10 error capture and streaming spans, update the Flutter wizard downloads, and clarify Replay support and verification. Restore production symbol uploads and add Dart prerequisites and CLI shutdown guidance. --- docs/platforms/dart/common/index.mdx | 48 ++++++++++++------- docs/platforms/dart/guides/flutter/index.mdx | 47 +++++++++++++----- includes/quick-start-features-expandable.mdx | 14 ++++++ ...quick-start-verify-tracing-splitlayout.mdx | 11 +++-- .../getting-started-prerequisites/dart.mdx | 8 ++++ src/components/featureInfo.tsx | 5 +- 6 files changed, 97 insertions(+), 36 deletions(-) create mode 100644 platform-includes/getting-started-prerequisites/dart.mdx diff --git a/docs/platforms/dart/common/index.mdx b/docs/platforms/dart/common/index.mdx index f0a150a364956..846f7f4ac50cd 100644 --- a/docs/platforms/dart/common/index.mdx +++ b/docs/platforms/dart/common/index.mdx @@ -33,7 +33,7 @@ dependencies: ## Configure -**Error Monitoring** starts working as soon as you call `Sentry.init()`. **Logs** and **Application Metrics** need no extra configuration in the current SDK, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). +Initialize **Error Monitoring** with `Sentry.init()` and run your application in its `appRunner` callback to capture uncaught exceptions and unhandled asynchronous errors. **Logs** and **Application Metrics** are enabled by default in SDK v10, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). This guide also enables **Tracing**. @@ -49,32 +49,42 @@ The snippet also turns on: - Tracing: via `tracesSampleRate` - Additional user and request data: via `sendDefaultPii` -Don't need a feature? Remove its integration and options from the snippet. +To skip tracing, omit `tracesSampleRate`. To discard logs or metrics, return `null` from `beforeSendLog` or `beforeSendMetric`. ```dart import 'package:sentry/sentry.dart'; Future main() async { - await Sentry.init((options) { - options.dsn = '___PUBLIC_DSN___'; - - // Adds request headers and IP to events. - options.sendDefaultPii = true; - - // Enables Tracing. - // Set to 1.0 to capture 100% of spans for tracing. - // We recommend reducing this value in production. - options.tracesSampleRate = 1.0; - }); + await Sentry.init( + (options) { + options.dsn = '___PUBLIC_DSN___'; + + // Allows sending default personal data, such as IP addresses, + // when available from the SDK's integrations. + options.sendDefaultPii = true; + + // Enables Tracing. + // Set to 1.0 to capture 100% of spans for tracing. + // We recommend reducing this value in production. + options.tracesSampleRate = 1.0; + }, + appRunner: () async { + // Start your application here. + }, + ); // You can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and // SENTRY_ENVIRONMENT via Dart environment variables (--dart-define). } ``` +The `appRunner` callback runs in a guarded error zone. This is required for automatic error capture on Dart web, where isolate error listeners are unavailable. For additional isolates, register an error listener with [`addSentryErrorListener`](https://pub.dev/documentation/sentry/latest/sentry_io/SentryIsolateExtension/addSentryErrorListener.html) from `package:sentry/sentry_io.dart`. + +For finite command-line applications, call `await Sentry.close()` after all awaited application work finishes to flush buffered telemetry and close SDK resources, including the isolate error-listener port. + ## Send Logs -Use `Sentry.logger` to send structured logs at different levels. You can add attributes to make logs easier to search and filter. +Call `Sentry.logger` from your application code after initialization to send structured logs at different levels. You can add attributes to make logs easier to search and filter. If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. @@ -92,21 +102,21 @@ Sentry.logger.error('Validation failed'); ## Send Application Metrics -Use `Sentry.metrics` to send counters, gauges, and distributions from your app. Add attributes to filter and group metrics in Sentry. +Call `Sentry.metrics` from your application code after initialization to send counters, gauges, and distributions. Add attributes to filter and group metrics in Sentry. See Set Up Metrics for metric types, attributes, and configuration options. ```dart Sentry.metrics.count('checkout.failed', 1); Sentry.metrics.gauge('queue.depth', 42); -Sentry.metrics.distribution('api_latency', 187); +Sentry.metrics.distribution('api_latency', 187, unit: 'millisecond'); ``` ## Verify Your Setup Let's test your setup and confirm that data reaches your Sentry project. -Add this to your async entry point after `Sentry.init()` to trigger and capture a test error: +Add this inside the async `appRunner` callback to trigger and capture a test error: ```dart try { @@ -119,6 +129,10 @@ try { } ``` +Run the log and metric examples from the previous steps after initialization to verify those products too. + + + ### View Captured Data in Sentry Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). diff --git a/docs/platforms/dart/guides/flutter/index.mdx b/docs/platforms/dart/guides/flutter/index.mdx index 12f02c08e5240..f586f9bc30d17 100644 --- a/docs/platforms/dart/guides/flutter/index.mdx +++ b/docs/platforms/dart/guides/flutter/index.mdx @@ -28,34 +28,34 @@ brew install getsentry/tools/sentry-wizard && sentry-wizard -i flutter ``` ```powershell {tabTitle:Windows} -$downloadUrl = "https://github.com/getsentry/sentry-wizard/releases/download/v5.1.0/sentry-wizard-win-x64.exe" +$downloadUrl = "https://github.com/getsentry/sentry-wizard/releases/download/v9.1.0/sentry-wizard-win-x64.exe" Invoke-WebRequest $downloadUrl -OutFile sentry-wizard.exe ./sentry-wizard.exe -i flutter ``` ```bash {tabTitle:macOS (Intel/x64)} -downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v5.1.0/sentry-wizard-darwin-x64" +downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v9.1.0/sentry-wizard-darwin-x64" curl -L $downloadUrl -o sentry-wizard chmod +x sentry-wizard ./sentry-wizard -i flutter ``` ```bash {tabTitle:macOS (Apple Silicon/arm64)} -downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v5.1.0/sentry-wizard-darwin-arm64" +downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v9.1.0/sentry-wizard-darwin-arm64" curl -L $downloadUrl -o sentry-wizard chmod +x sentry-wizard ./sentry-wizard -i flutter ``` ```bash {tabTitle:Linux (x64)} -downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v5.1.0/sentry-wizard-linux-x64" +downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v9.1.0/sentry-wizard-linux-x64" curl -L $downloadUrl -o sentry-wizard chmod +x sentry-wizard ./sentry-wizard -i flutter ``` ```bash {tabTitle:Linux (arm64)} -downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v5.1.0/sentry-wizard-linux-arm64" +downloadUrl="https://github.com/getsentry/sentry-wizard/releases/download/v9.1.0/sentry-wizard-linux-arm64" curl -L $downloadUrl -o sentry-wizard chmod +x sentry-wizard ./sentry-wizard -i flutter @@ -79,8 +79,8 @@ If you prefer, you can also [set up the SDK manually](/platforms/dart/guides/flu ## Configure -**Error Monitoring** starts working as soon as you call `SentryFlutter.init()`. **Logs** and **Application Metrics** need no extra configuration in the current SDK, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). -This guide also enables **Tracing** and **Session Replay**. Collect **User Feedback** with the Flutter SDK's feedback form or API. +**Error Monitoring** starts working as soon as you call `SentryFlutter.init()`. **Logs** and **Application Metrics** are enabled by default in SDK v10, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). +This guide also enables **Tracing** and **Session Replay**. Flutter Session Replay is available on **iOS and Android**. Collect **User Feedback** with the Flutter SDK's feedback form or API. @@ -96,7 +96,7 @@ The snippet also turns on: - Session Replay: via `SentryWidget`, sampled with `sessionSampleRate` and `onErrorSampleRate` - Additional user and request data: via `sendDefaultPii` -Don't need a feature? Remove its integration and options from the snippet. +To skip tracing, omit `tracesSampleRate`. To skip automatic Session Replay recording, omit both replay sample rates. To discard logs or metrics, return `null` from `beforeSendLog` or `beforeSendMetric`. ```dart import 'package:flutter/widgets.dart'; @@ -107,7 +107,8 @@ Future main() async { (options) { options.dsn = '___PUBLIC_DSN___'; - // Adds request headers and IP to events. + // Allows sending default personal data, such as IP addresses, + // when available from the SDK's integrations. options.sendDefaultPii = true; // Enables Tracing. @@ -133,7 +134,7 @@ Future main() async { ## Send Logs -Use `Sentry.logger` to send structured logs at different levels. You can add attributes to make logs easier to search and filter. +Call `Sentry.logger` from your application code after initialization to send structured logs at different levels. You can add attributes to make logs easier to search and filter. If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. @@ -151,7 +152,7 @@ Sentry.logger.error('Validation failed'); ## Send Application Metrics -Use `Sentry.metrics` to send counters, gauges, and distributions from your app. Add attributes to filter and group metrics in Sentry. +Call `Sentry.metrics` from your application code after initialization to send counters, gauges, and distributions. Add attributes to filter and group metrics in Sentry. See Set Up Metrics for metric types, attributes, and configuration options. @@ -165,7 +166,20 @@ Sentry.metrics.distribution('api_latency', 187, unit: 'millisecond'); Let's test your setup and confirm that data reaches your Sentry project. -The wizard added a sample exception to `main.dart` that is captured when the app starts. Run your app to send it to Sentry: +The wizard adds a sample exception to `main.dart` after `SentryFlutter.init()`. Keep that exception when updating your initialization code. If it is missing, add this after `await SentryFlutter.init(...)` in your `main` function: + +```dart +try { + throw StateError('Sentry Test Error'); +} catch (exception, stackTrace) { + await Sentry.captureException( + exception, + stackTrace: stackTrace, + ); +} +``` + +Run your app to send the test error to Sentry: ```bash flutter run @@ -173,6 +187,14 @@ flutter run After you've confirmed the issue in Sentry, remove the sample exception from `main.dart` so it isn't captured on every launch. +Run the log and metric examples from the previous steps after initialization to verify those products too. + + + +### Session Replay + +To verify Replay, temporarily set `options.replay.sessionSampleRate = 1.0` during initialization and restart your app on iOS or Android. Interact with the app, then open **Replays** in Sentry. Set the sample rate back to `0.1` after testing. + ### View Captured Data in Sentry Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). @@ -184,6 +206,7 @@ Now, head over to your project on [Sentry.io](https://sentry.io) to view the col At this point, you should have integrated Sentry into your Flutter application. Here's what to explore next: - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup +- Upload debug symbols and source maps for readable production stack traces. The wizard configures `sentry_dart_plugin`; run `dart run sentry_dart_plugin` after each production build to upload the files. In CI, provide `SENTRY_AUTH_TOKEN` to the upload step. - Learn about Session Replay and its privacy controls - Add performance instrumentation to your app diff --git a/includes/quick-start-features-expandable.mdx b/includes/quick-start-features-expandable.mdx index 7ecb9d1fdd697..f1585884326f9 100644 --- a/includes/quick-start-features-expandable.mdx +++ b/includes/quick-start-features-expandable.mdx @@ -82,6 +82,11 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo"; @@ -91,6 +96,15 @@ import { FeatureInfo } from "sentry-docs/components/featureInfo"; diff --git a/includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx b/includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx index 3ca0aee8a780e..31332a6612334 100644 --- a/includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx +++ b/includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx @@ -1,10 +1,11 @@ ### Tracing -To test your tracing configuration, create a custom transaction and span: +To verify tracing, run this after SDK initialization, such as inside an async `appRunner` callback. Setting `tracesSampleRate` enables sampling; instrumenting an operation creates the span: ```dart -final transaction = Sentry.startTransaction('test-transaction', 'task'); -final span = transaction.startChild('test-span'); -await span.finish(); -await transaction.finish(); +await Sentry.startSpan('setup-verification', (_) async { + await Future.delayed(const Duration(milliseconds: 100)); +}); ``` + +SDK v10 uses streaming spans by default. `Sentry.startSpan` ends the span automatically when its callback completes. For the older transaction APIs, see trace lifecycle modes. diff --git a/platform-includes/getting-started-prerequisites/dart.mdx b/platform-includes/getting-started-prerequisites/dart.mdx new file mode 100644 index 0000000000000..9675f9bacf075 --- /dev/null +++ b/platform-includes/getting-started-prerequisites/dart.mdx @@ -0,0 +1,8 @@ +## Prerequisites + +These instructions use Sentry Dart SDK v10. You need: + +- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/) +- An application using **Dart 3.12.0** or later + +For an existing Sentry integration, review the [v10 breaking changes](https://github.com/getsentry/sentry-dart/releases/tag/10.0.0) before upgrading. diff --git a/src/components/featureInfo.tsx b/src/components/featureInfo.tsx index cc77785831c70..2b46ce8411d2b 100644 --- a/src/components/featureInfo.tsx +++ b/src/components/featureInfo.tsx @@ -145,6 +145,7 @@ const FEATURE_DATA: Record< type FeatureInfoProps = { features: FeatureKey[]; + overrides?: Partial>; type: 'learnMore' | 'findInSentry'; }; @@ -155,11 +156,11 @@ type FeatureInfoProps = { * @param features - Array of feature keys to display * @param type - learnMore shows feature descriptions, findInSentry shows navigation help */ -export function FeatureInfo({features, type}: FeatureInfoProps) { +export function FeatureInfo({features, overrides, type}: FeatureInfoProps) { return (
    {features.map(key => { - const feature = FEATURE_DATA[key]; + const feature = {...FEATURE_DATA[key], ...overrides?.[key]}; if (type === 'learnMore') { return ( From 26f383432b5808197bc60debee80e7c989bbff40 Mon Sep 17 00:00:00 2001 From: inventarSarah Date: Tue, 3 Nov 2026 11:50:43 +0100 Subject: [PATCH 5/5] review and update; update manual setup for flutter --- docs/platforms/dart/common/index.mdx | 12 +-- docs/platforms/dart/guides/flutter/index.mdx | 86 +---------------- .../dart/guides/flutter/manual-setup.mdx | 94 +++++++++++++------ ...quick-start-verify-tracing-splitlayout.mdx | 11 --- ...quick-start-verify-tracing-splitlayout.mdx | 20 ---- 5 files changed, 72 insertions(+), 151 deletions(-) delete mode 100644 includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx delete mode 100644 includes/tracing/python-quick-start-verify-tracing-splitlayout.mdx diff --git a/docs/platforms/dart/common/index.mdx b/docs/platforms/dart/common/index.mdx index 846f7f4ac50cd..f07037199fb88 100644 --- a/docs/platforms/dart/common/index.mdx +++ b/docs/platforms/dart/common/index.mdx @@ -1,6 +1,6 @@ --- title: Dart -description: Learn how to set up Sentry in your Dart app, capture your first events and traces, and view them in Sentry. +description: Learn how to set up Sentry in your Dart app, capture your first events, and view them in Sentry. caseStyle: camelCase supportLevel: production sdk: sentry.dart @@ -42,7 +42,7 @@ This guide also enables **Tracing**. Configuration should happen as **early as possible** in your application's lifecycle. -Import and initialize the SDK in your app's entry point: +Import and initialize the SDK in your app's entry point as shown in the code snippet below. The snippet also turns on: @@ -86,8 +86,6 @@ For finite command-line applications, call `await Sentry.close()` after all awai Call `Sentry.logger` from your application code after initialization to send structured logs at different levels. You can add attributes to make logs easier to search and filter. -If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. - See Set Up Logs for all available logging methods and message formatting. ```dart @@ -100,6 +98,8 @@ Sentry.logger.warn('Slow operation detected'); Sentry.logger.error('Validation failed'); ``` +If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. + ## Send Application Metrics Call `Sentry.metrics` from your application code after initialization to send counters, gauges, and distributions. Add attributes to filter and group metrics in Sentry. @@ -129,10 +129,6 @@ try { } ``` -Run the log and metric examples from the previous steps after initialization to verify those products too. - - - ### View Captured Data in Sentry Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). diff --git a/docs/platforms/dart/guides/flutter/index.mdx b/docs/platforms/dart/guides/flutter/index.mdx index f586f9bc30d17..ee03b862a1d1a 100644 --- a/docs/platforms/dart/guides/flutter/index.mdx +++ b/docs/platforms/dart/guides/flutter/index.mdx @@ -1,6 +1,6 @@ --- title: Flutter -description: Learn how to set up Sentry in your Flutter app, capture your first events and traces, and view them in Sentry. +description: Learn how to set up Sentry in your Flutter app, capture your first events, and view them in Sentry. caseStyle: camelCase supportLevel: production sdk: sentry.dart.flutter @@ -65,7 +65,7 @@ chmod +x sentry-wizard npx @sentry/wizard@latest -i flutter ``` -This will patch your project and configure the SDK. You only need to patch the project once, then you can add the patched files to your version control system. +This will patch your project and configure the SDK. **Logs** and **Application Metrics** are enabled by default in SDK v10, and you'll learn how to send them in steps [#2](#send-logs) and [#3](#send-application-metrics-). You only need to patch the project once, then you can add the patched files to your version control system. If you prefer, you can also [set up the SDK manually](/platforms/dart/guides/flutter/manual-setup/). @@ -77,67 +77,10 @@ If you prefer, you can also [set up the SDK manually](/platforms/dart/guides/flu -## Configure - -**Error Monitoring** starts working as soon as you call `SentryFlutter.init()`. **Logs** and **Application Metrics** are enabled by default in SDK v10, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). -This guide also enables **Tracing** and **Session Replay**. Flutter Session Replay is available on **iOS and Android**. Collect **User Feedback** with the Flutter SDK's feedback form or API. - - - -### Initialize the Sentry SDK - -The wizard patches `main.dart` with `SentryFlutter.init` and prompts you for optional features. Enable Tracing and Session Replay when prompted, or update `main.dart` to match this snippet. - -Import and initialize the SDK in your app's `main` function: - -The snippet also turns on: - -- Tracing: via `tracesSampleRate` -- Session Replay: via `SentryWidget`, sampled with `sessionSampleRate` and `onErrorSampleRate` -- Additional user and request data: via `sendDefaultPii` - -To skip tracing, omit `tracesSampleRate`. To skip automatic Session Replay recording, omit both replay sample rates. To discard logs or metrics, return `null` from `beforeSendLog` or `beforeSendMetric`. - -```dart -import 'package:flutter/widgets.dart'; -import 'package:sentry_flutter/sentry_flutter.dart'; - -Future main() async { - await SentryFlutter.init( - (options) { - options.dsn = '___PUBLIC_DSN___'; - - // Allows sending default personal data, such as IP addresses, - // when available from the SDK's integrations. - options.sendDefaultPii = true; - - // Enables Tracing. - // Set to 1.0 to capture 100% of spans for tracing. - // We recommend reducing this value in production. - options.tracesSampleRate = 1.0; - - // Capture replays for 10% of sessions and 100% of sessions with an error. - options.replay.sessionSampleRate = 0.1; - options.replay.onErrorSampleRate = 1.0; - }, - appRunner: () => runApp( - SentryWidget( - child: MyApp(), - ), - ), - ); - - // You can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and - // SENTRY_ENVIRONMENT via Dart environment variables (--dart-define). -} -``` - ## Send Logs Call `Sentry.logger` from your application code after initialization to send structured logs at different levels. You can add attributes to make logs easier to search and filter. -If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. - See Set Up Logs for all available logging methods and message formatting. ```dart @@ -150,6 +93,8 @@ Sentry.logger.warn('Slow operation detected'); Sentry.logger.error('Validation failed'); ``` +If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. + ## Send Application Metrics Call `Sentry.metrics` from your application code after initialization to send counters, gauges, and distributions. Add attributes to filter and group metrics in Sentry. @@ -166,20 +111,7 @@ Sentry.metrics.distribution('api_latency', 187, unit: 'millisecond'); Let's test your setup and confirm that data reaches your Sentry project. -The wizard adds a sample exception to `main.dart` after `SentryFlutter.init()`. Keep that exception when updating your initialization code. If it is missing, add this after `await SentryFlutter.init(...)` in your `main` function: - -```dart -try { - throw StateError('Sentry Test Error'); -} catch (exception, stackTrace) { - await Sentry.captureException( - exception, - stackTrace: stackTrace, - ); -} -``` - -Run your app to send the test error to Sentry: +The wizard added a sample exception to main.dart that is captured when the app starts. Run your app to send it to Sentry: ```bash flutter run @@ -187,14 +119,6 @@ flutter run After you've confirmed the issue in Sentry, remove the sample exception from `main.dart` so it isn't captured on every launch. -Run the log and metric examples from the previous steps after initialization to verify those products too. - - - -### Session Replay - -To verify Replay, temporarily set `options.replay.sessionSampleRate = 1.0` during initialization and restart your app on iOS or Android. Interact with the app, then open **Replays** in Sentry. Set the sample rate back to `0.1` after testing. - ### View Captured Data in Sentry Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear). diff --git a/docs/platforms/dart/guides/flutter/manual-setup.mdx b/docs/platforms/dart/guides/flutter/manual-setup.mdx index 01831e8b2c5d4..33ab575b30990 100644 --- a/docs/platforms/dart/guides/flutter/manual-setup.mdx +++ b/docs/platforms/dart/guides/flutter/manual-setup.mdx @@ -1,10 +1,14 @@ --- title: Manual Setup sidebar_order: 1 -description: "Learn how to set up the Sentry Flutter SDK manually." +description: "Learn how to manually set up Sentry in your Flutter app, capture your first events, and view them in Sentry." --- -If you can't (or prefer not to) run the [automatic setup](/platforms/dart/guides/flutter/#install), you can follow the instructions below to configure your application manually. + + +Looking for automatic setup with the Flutter wizard? Follow the Flutter Quick Start instead. Continue with this guide to set up the SDK manually. + + @@ -36,19 +40,24 @@ Keep CocoaPods if other plugins still require it. Flutter can use both dependenc ## Configure -Choose the features you want to configure, and this guide will show you how: - - +Initialize **Error Monitoring** with `Sentry.init()` and run your application in its `appRunner` callback to capture uncaught exceptions and unhandled asynchronous errors. **Logs** and **Application Metrics** are enabled by default in SDK v10, and you'll learn how to send them in steps [#3](#send-logs) and [#4](#send-application-metrics-). +This guide also enables **Tracing** and **Session Replay**. ### Initialize the Sentry SDK -Configuration should happen as **early as possible** in your application's lifecycle. Logs and metrics are enabled by default; use `Sentry.logger` and `Sentry.metrics` after initialization without an enable flag. +Configuration should happen as **early as possible** in your application's lifecycle. + +Import and initialize the SDK in your app's entry point as shown in the code snippet below. -Import and initialize the SDK in your app's `main` function: +The snippet also turns on: + +- Tracing: via `tracesSampleRate` +- Session Replay: sampled with `replay.sessionSampleRate` and `replay.onErrorSampleRate` +- Additional user and request data: via `sendDefaultPii` + +To skip tracing, omit `tracesSampleRate`. To skip automatic Session Replay recording, omit both replay sample rates. To discard logs or metrics, return `null` from `beforeSendLog` or `beforeSendMetric`. ```dart import 'package:flutter/widgets.dart'; @@ -58,19 +67,20 @@ Future main() async { await SentryFlutter.init( (options) { options.dsn = '___PUBLIC_DSN___'; - // Adds request headers and IP for users, for more info visit: - // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ + + /// Allows sending default personal data, such as IP addresses, + // when available from the SDK's integrations. options.sendDefaultPii = true; - // ___PRODUCT_OPTION_START___ performance - // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. - // We recommend adjusting this value in production. + + // Enables Tracing. + // Set to 1.0 to capture 100% of spans for tracing. + // We recommend reducing this value in production. options.tracesSampleRate = 1.0; - // ___PRODUCT_OPTION_END___ performance - // ___PRODUCT_OPTION_START___ session-replay - // Record session replays for 100% of errors and 10% of sessions + + // Capture replays for 10% of all sessions, + // plus for 100% of sessions with an error options.replay.onErrorSampleRate = 1.0; options.replay.sessionSampleRate = 0.1; - // ___PRODUCT_OPTION_END___ session-replay }, appRunner: () => runApp( SentryWidget( @@ -84,13 +94,41 @@ Future main() async { } ``` +## Send Logs + +Call `Sentry.logger` from your application code after initialization to send structured logs at different levels. You can add attributes to make logs easier to search and filter. + +See Set Up Logs for all available logging methods and message formatting. + +```dart +Sentry.logger.info('Order completed', attributes: { + 'order_id': SentryAttribute.string('12345'), + 'total': SentryAttribute.double(99.99), +}); + +Sentry.logger.warn('Slow operation detected'); +Sentry.logger.error('Validation failed'); +``` + +If you use the Dart `logging` package, add the `sentry_logging` integration to send its records to Sentry. + +## Send Application Metrics + +Call `Sentry.metrics` from your application code after initialization to send counters, gauges, and distributions. Add attributes to filter and group metrics in Sentry. + +See Set Up Metrics for metric types, attributes, and configuration options. + +```dart +Sentry.metrics.count('checkout.failed', 1); +Sentry.metrics.gauge('queue.depth', 42); +Sentry.metrics.distribution('api_latency', 187, unit: 'millisecond'); +``` + ## Verify Your Setup Let's test your setup and confirm that data reaches your Sentry project. -### Issues - -To verify that Sentry captures errors and creates issues in your Sentry project, add this intentional error to your application: +Add this intentional error to your application: ```dart import 'package:sentry_flutter/sentry_flutter.dart'; @@ -105,15 +143,11 @@ try { } ``` - - - - - +Run your app to send the test error to Sentry: - - - +```bash +flutter run +``` ### View Captured Data in Sentry @@ -129,9 +163,7 @@ Now's a good time to customize your setup and look into more advanced topics. Our next recommended steps for you are: - Explore [practical guides](/get-started/guides/) on what to monitor, log, track, and investigate after setup -- Continue to customize your configuration - Add readable stack traces to errors -- Learn about the features of Sentry's Flutter SDK - Add performance instrumentation to your app diff --git a/includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx b/includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx deleted file mode 100644 index 31332a6612334..0000000000000 --- a/includes/tracing/dart-quick-start-verify-tracing-splitlayout.mdx +++ /dev/null @@ -1,11 +0,0 @@ -### Tracing - -To verify tracing, run this after SDK initialization, such as inside an async `appRunner` callback. Setting `tracesSampleRate` enables sampling; instrumenting an operation creates the span: - -```dart -await Sentry.startSpan('setup-verification', (_) async { - await Future.delayed(const Duration(milliseconds: 100)); -}); -``` - -SDK v10 uses streaming spans by default. `Sentry.startSpan` ends the span automatically when its callback completes. For the older transaction APIs, see trace lifecycle modes. diff --git a/includes/tracing/python-quick-start-verify-tracing-splitlayout.mdx b/includes/tracing/python-quick-start-verify-tracing-splitlayout.mdx deleted file mode 100644 index ecda5df7f65d7..0000000000000 --- a/includes/tracing/python-quick-start-verify-tracing-splitlayout.mdx +++ /dev/null @@ -1,20 +0,0 @@ -### Tracing - -To test your tracing configuration, create a custom transaction and span: - -```py {tabTitle: Transaction Mode (Default)} -import sentry_sdk - -with sentry_sdk.start_transaction(op="task", name="Transaction Name"): - span = sentry_sdk.start_span(name="Custom Span Name") - span.finish() - -``` -```py {tabTitle: Stream Mode} -import sentry_sdk - -with sentry_sdk.traces.start_span(name="Service Span Name", attributes={"sentry.op": "task"}, parent_span=None): - span = sentry_sdk.traces.start_span(name="Custom Span Name") - span.end() - -```