diff --git a/includes/dart-integrations/app-start-instrumentation.mdx b/includes/dart-integrations/app-start-instrumentation.mdx index 2212c45a5872e..bf81d171b5df4 100644 --- a/includes/dart-integrations/app-start-instrumentation.mdx +++ b/includes/dart-integrations/app-start-instrumentation.mdx @@ -10,6 +10,8 @@ platforms: - flutter --- + + Sentry's app start instrumentation provides insight into how long your application takes to launch. diff --git a/includes/dart-integrations/asset-bundle-instrumentation.mdx b/includes/dart-integrations/asset-bundle-instrumentation.mdx index ed9e6c822c204..9c578e24dd7c1 100644 --- a/includes/dart-integrations/asset-bundle-instrumentation.mdx +++ b/includes/dart-integrations/asset-bundle-instrumentation.mdx @@ -10,6 +10,12 @@ platforms: - flutter --- + + +Asset bundle instrumentation isn't supported in stream mode yet — it creates spans only in the default transaction mode. + + + [AssetBundle](https://api.flutter.dev/flutter/services/AssetBundle-class.html) instrumentation provides insight into how long your app takes to load its assets, such as files. ## Instrumentation Behaviour diff --git a/includes/dart-integrations/dio.mdx b/includes/dart-integrations/dio.mdx index f0e161c09b29e..85a444a2c0a27 100644 --- a/includes/dart-integrations/dio.mdx +++ b/includes/dart-integrations/dio.mdx @@ -7,6 +7,8 @@ platforms: sidebar_order: 4 --- + + The `sentry_dio` library provides [Dio](https://pub.dev/packages/dio) support for Sentry using the [HttpClientAdapter](https://pub.dev/documentation/dio/latest/dio/HttpClientAdapter-class.html). It is able to collect breadcrumbs, run tracing for HTTP requests, and capture events for failed requests. ## Install @@ -121,7 +123,7 @@ The Dio integration also provides insight into tracing for your HTTP requests do ### Instrumentation Behaviour -- The created spans will be attached to the transaction on the scope - if no transaction is on the scope the span will not be sent to Sentry. +- The created spans attach to the active span. In transaction mode, that's the transaction bound to the scope; in stream mode, it's the span started with `Sentry.startSpan()`. If no span is active, the span won't be sent to Sentry. - The SDK sets the span operation to `http.client` and the description to request `$METHOD $url`. For example, `GET https://sentry.io`. - The span finishes once the request has been executed. - The span status depends on either the HTTP response code or `SpanStatus.internalError()` if the code does not match any of Sentry's SpanStatus options. @@ -150,7 +152,7 @@ dio.addSentry(); #### 1. Execute the Code -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} import 'package:sentry_dio/sentry_dio.dart'; Future makeWebRequestWithDio() async { @@ -181,6 +183,24 @@ Future makeWebRequestWithDio() async { } ``` +```dart {tabTitle:Stream Mode} +import 'package:sentry_dio/sentry_dio.dart'; + +Future makeWebRequestWithDio() async { + final dio = Dio(); + dio.addSentry(); + + // Start a root span — the Dio integration attaches a span for the request + await Sentry.startSpan('dio-web-request', (span) async { + try { + final response = await dio.get(exampleUrl); + } catch (exception, stackTrace) { + await Sentry.captureException(exception, stackTrace: stackTrace); + } + }, parentSpan: null); +} +``` + #### 2. View the Transaction on Sentry.io To view the recorded transaction, log into [sentry.io](https://sentry.io) and open your project. diff --git a/includes/dart-integrations/drift-instrumentation.mdx b/includes/dart-integrations/drift-instrumentation.mdx index b5a7fd68ae984..ac3bb1bfe2f10 100644 --- a/includes/dart-integrations/drift-instrumentation.mdx +++ b/includes/dart-integrations/drift-instrumentation.mdx @@ -10,12 +10,14 @@ platforms: - flutter --- + + Drift is a library for easily managing SQLite databases within Flutter applications. The [sentry_drift](https://pub.dev/packages/sentry_drift) package provides `Drift` support for database performance instrumentation and allows you to track the performance of your queries. ## Instrumentation Behaviour -The created spans will be attached to the transaction on the scope - if no transaction is on the scope the Drift span will not be sent to Sentry. +The created spans attach to the active span. In transaction mode, that's the transaction bound to the scope; in stream mode, it's the span started with `Sentry.startSpan()`. If no span is active, the Drift span won't be sent to Sentry. ## Prerequisites @@ -60,7 +62,7 @@ await database.runWithInterceptor(interceptor: interceptor, () async { ### 1. Execute the Code -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} import 'package:drift/drift.dart'; import 'package:drift/native.dart'; import 'package:sentry/sentry.dart'; @@ -93,6 +95,34 @@ Future driftTest() async { } ``` +```dart {tabTitle:Stream Mode} +import 'package:drift/drift.dart'; +import 'package:drift/native.dart'; +import 'package:sentry/sentry.dart'; +import 'package:sentry_drift/sentry_drift.dart'; + +import 'your_database.dart'; + +Future driftTest() async { + await Sentry.startSpan('driftTest', (span) async { + final interceptor = SentryQueryInterceptor(databaseName: 'my_database_name'); + final executor = inMemoryExecutor().interceptWith(interceptor); + final db = AppDatabase(executor); + + await db.into(db.todoItems).insert( + TodoItemsCompanion.insert( + title: 'This is a test title', + content: 'test', + ), + ); + + final items = await db.select(db.todoItems).get(); + + await db.close(); + }, parentSpan: null); +} +``` + ### 2. View the Transaction on Sentry.io To view the recorded transaction, log into [sentry.io](https://sentry.io) and open your project. diff --git a/includes/dart-integrations/file.mdx b/includes/dart-integrations/file.mdx index 57ff19c7708f6..80a7c9bade763 100644 --- a/includes/dart-integrations/file.mdx +++ b/includes/dart-integrations/file.mdx @@ -7,12 +7,14 @@ platforms: - flutter --- + + File I/O operations are fundamental for reading from and writing to files within an application. The `sentry_file` integration provides [File](https://api.dart.dev/stable/2.18.5/dart-io/File-class.html) support for Sentry thus providing insight into tracing of file operations. ## Behavior -- The created spans will be attached to the transaction on the scope - if no transaction is on the scope the File I/O span will not be sent to Sentry. +- The created spans attach to the active span. In transaction mode, that's the transaction bound to the scope; in stream mode, it's the span started with `Sentry.startSpan()`. If no span is active, the File I/O span won't be sent to Sentry. - The File I/O integration is only available for the `dart:io:File` class, not for the `dart:html:File` class. - The SDK sets the span `operation` to `file.copy`, `file.write`, `file.delete`, `file.open`, `file.read` or `file.rename`, and `description` to `filename` (for example, `file.txt`). - The span finishes once the operation has been executed. The span `status` is then set to `SpanStatus.ok` if successful, or `SpanStatus.internalError` if there was an error. @@ -45,7 +47,7 @@ final sentryFile = file.sentryTrace(); ### 1. Execute the Code -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} import 'package:sentry/sentry.dart'; import 'package:sentry_file/sentry_file.dart'; import 'dart:io'; @@ -92,6 +94,48 @@ Future runApp() async { } ``` +```dart {tabTitle:Stream Mode} +import 'package:sentry/sentry.dart'; +import 'package:sentry_file/sentry_file.dart'; +import 'dart:io'; + +Future main() async { + await Sentry.init( + (options) { + options.dsn = 'https://example@sentry.io/example'; + // To set a uniform sample rate + options.tracesSampleRate = 1.0; + // Enables stream mode + options.traceLifecycle = SentryTraceLifecycle.stream; + }, + appRunner: runApp, // Init your App. + ); +} + +Future runApp() async { + final file = File('my_file.txt'); + // Call the Sentry extension method to wrap up the File + final sentryFile = file.sentryTrace(); + + // Start a root span — file I/O spans attach to the active span + await Sentry.startSpan('MyFileExample', (span) async { + // create the File + await sentryFile.create(); + // Write some content + await sentryFile.writeAsString('Hello World'); + // Read the content + final text = await sentryFile.readAsString(); + + print(text); + + // Delete the file + await sentryFile.delete(); + }, parentSpan: null); + + await Sentry.close(); +} +``` + ### 2. View the Recorded Transaction on Sentry.io To view the recorded transaction, log into [sentry.io](https://sentry.io) and open your project. diff --git a/includes/dart-integrations/graphql.mdx b/includes/dart-integrations/graphql.mdx index 00ef3989eff2e..f9aad81c43c01 100644 --- a/includes/dart-integrations/graphql.mdx +++ b/includes/dart-integrations/graphql.mdx @@ -7,6 +7,8 @@ platforms: - flutter --- + + The `sentry_link` integration adds Sentry instrumentation to GraphQL clients built on the [gql](https://pub.dev/packages/gql) ecosystem. It helps you capture: @@ -78,15 +80,15 @@ For better error context and grouping, add the recommended init options from [Ad ## `SentryGql.link()` Options -| Parameter | Type | Default | Description | -| --- | --- | --- | --- | -| `shouldStartTransaction` | `bool` | _required_ | Set to `true` to start a transaction per GraphQL operation when no active span/transaction exists. | -| `graphQlErrorsMarkTransactionAsFailed` | `bool` | _required_ | Set to `true` to mark GraphQL spans/transactions as `unknownError` when `response.errors` exists. | -| `enableBreadcrumbs` | `bool` | `true` | Records breadcrumbs for successful GraphQL operations. | -| `reportExceptions` | `bool` | `true` | Captures `LinkException` failures as Sentry events. | -| `reportExceptionsAsBreadcrumbs` | `bool` | `false` | Records `LinkException` failures as breadcrumbs instead of events. | -| `reportGraphQlErrors` | `bool` | `true` | Captures GraphQL response errors as Sentry events. | -| `reportGraphQlErrorsAsBreadcrumbs` | `bool` | `false` | Records GraphQL response errors as breadcrumbs instead of events. | +| Parameter | Type | Default | Description | +| -------------------------------------- | ------ | ---------- | -------------------------------------------------------------------------------------------------- | +| `shouldStartTransaction` | `bool` | _required_ | Set to `true` to start a transaction per GraphQL operation when no active span/transaction exists. | +| `graphQlErrorsMarkTransactionAsFailed` | `bool` | _required_ | Set to `true` to mark GraphQL spans/transactions as `unknownError` when `response.errors` exists. | +| `enableBreadcrumbs` | `bool` | `true` | Records breadcrumbs for successful GraphQL operations. | +| `reportExceptions` | `bool` | `true` | Captures `LinkException` failures as Sentry events. | +| `reportExceptionsAsBreadcrumbs` | `bool` | `false` | Records `LinkException` failures as breadcrumbs instead of events. | +| `reportGraphQlErrors` | `bool` | `true` | Captures GraphQL response errors as Sentry events. | +| `reportGraphQlErrorsAsBreadcrumbs` | `bool` | `false` | Records GraphQL response errors as breadcrumbs instead of events. | ## Error Reporting Layers @@ -381,6 +383,14 @@ final link = Link.from([ ), ]); +Map? _defaultHttpResponseDecoder(http.Response response) { + return json.decode(utf8.decode(response.bodyBytes)) as Map?; +} +``` + +The decoder itself creates the span. In transaction mode, it starts a child off the currently active transaction. In stream mode, `Sentry.startSpanSync()` is used instead, which attaches the new span to the currently active span automatically and sets its status based on whether the callback throws: + +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} Map? sentryResponseDecoder( http.Response response, { Hub? hub, @@ -403,9 +413,17 @@ Map? sentryResponseDecoder( } return result; } +``` -Map? _defaultHttpResponseDecoder(http.Response response) { - return json.decode(utf8.decode(response.bodyBytes)) as Map?; +```dart {tabTitle:Stream Mode} +Map? sentryResponseDecoder( + http.Response response, { + Hub? hub, +}) { + return Sentry.startSpanSync( + 'serialize.http.client', + (span) => _defaultHttpResponseDecoder(response), + ); } ``` diff --git a/includes/dart-integrations/hive-instrumentation.mdx b/includes/dart-integrations/hive-instrumentation.mdx index 8568aa56274cb..6f82a6b2d0e5c 100644 --- a/includes/dart-integrations/hive-instrumentation.mdx +++ b/includes/dart-integrations/hive-instrumentation.mdx @@ -10,6 +10,8 @@ platforms: - flutter --- + + _(New in version 7.13.1)_ @@ -19,7 +21,7 @@ The [sentry_hive](https://pub.dev/packages/sentry_hive) package provides `Hive` ## Instrumentation Behaviour -The created spans will be attached to the transaction on the scope - if no transaction is on the scope the Hive span will not be sent to Sentry. +The created spans attach to the active span. In transaction mode, that's the transaction bound to the scope; in stream mode, it's the span started with `Sentry.startSpan()`. If no span is active, the Hive span won't be sent to Sentry. ## Prerequisites @@ -55,7 +57,7 @@ SentryHive.init(appDir.path); ### 1. Execute the Code -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} import 'package:sentry_hive/sentry_hive.dart'; Future hiveTest() async { @@ -80,6 +82,25 @@ Future hiveTest() async { } ``` +```dart {tabTitle:Stream Mode} +import 'package:sentry_hive/sentry_hive.dart'; + +Future hiveTest() async { + await Sentry.startSpan('hiveTest', (span) async { + final appDir = await getApplicationDocumentsDirectory(); + SentryHive.init(appDir.path); + + final catsBox = await SentryHive.openBox('cats'); + await catsBox.put('fluffy', {'name': 'Fluffy', 'age': 4}); + await catsBox.put('loki', {'name': 'Loki', 'age': 2}); + await catsBox.clear(); + await catsBox.close(); + + SentryHive.close(); + }, parentSpan: null); +} +``` + ### 2. View the Transaction on Sentry.io To view the recorded transaction, log into [sentry.io](https://sentry.io) and open your project. diff --git a/includes/dart-integrations/http-integration.mdx b/includes/dart-integrations/http-integration.mdx index 90df7dda92e24..c7b9f4d6259f3 100644 --- a/includes/dart-integrations/http-integration.mdx +++ b/includes/dart-integrations/http-integration.mdx @@ -7,6 +7,8 @@ platforms: - flutter --- + + ## Using the `SentryHttpClient` function You can use the `SentryHttpClient` and call its methods directly, or you can use it with the [`runWithClient`](https://pub.dev/documentation/http/latest/http/runWithClient.html) function. If you need to use a fresh instance of the `client` (so that other instances are not affected) or to run in a separate [`Zone`](https://api.dart.dev/stable/3.5.0/dart-async/Zone-class.html), which allows you to override the functionality of the existing [`Zone`](https://api.dart.dev/stable/3.5.0/dart-async/Zone-class.html), then use the `runWithClient` function (see the `runWithClient` tab). Otherwise, just use `SentryHttpClient` directly and call its methods (see the `default` tab). @@ -184,9 +186,9 @@ Capturing transactions requires that you first set -The `SentryHttpClient` starts a span out of the active span bound to the scope for each HTTP Request. +The `SentryHttpClient` starts a span off the active span for each HTTP request. In transaction mode, that's the transaction bound to the scope; in stream mode, it's the span started with `Sentry.startSpan()`. -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} import 'package:sentry/sentry.dart'; final transaction = Sentry.startTransaction( @@ -206,3 +208,19 @@ try { await transaction.finish(status: SpanStatus.ok()); ``` + +```dart {tabTitle:Stream Mode} +import 'package:sentry/sentry.dart'; + +// Start a root span — a span is attached for each HTTP request +await Sentry.startSpan('webrequest', (span) async { + var client = SentryHttpClient(); + try { + var uriResponse = await client.post('https://example.com/whatsit/create', + body: {'name': 'doodle', 'color': 'blue'}); + print(await client.get(uriResponse.bodyFields['uri'])); + } finally { + client.close(); + } +}, parentSpan: null); +``` diff --git a/includes/dart-integrations/index.mdx b/includes/dart-integrations/index.mdx index 597a16c57ac38..0faf6b3afb3eb 100644 --- a/includes/dart-integrations/index.mdx +++ b/includes/dart-integrations/index.mdx @@ -1,3 +1,5 @@ + + | **Integration** | **Auto
Enabled** | **Errors** | **Tracing** | **Additional
Context** | | ----------------------------------------------------- | :--------------: | :--------: | :---------: | :--------------------: | diff --git a/includes/dart-integrations/isar-instrumentation.mdx b/includes/dart-integrations/isar-instrumentation.mdx index 538ca3cdf2884..280a6ef1ad09e 100644 --- a/includes/dart-integrations/isar-instrumentation.mdx +++ b/includes/dart-integrations/isar-instrumentation.mdx @@ -10,6 +10,8 @@ platforms: - flutter --- + + _(New in version 7.16.0)_ @@ -19,7 +21,7 @@ The [sentry_isar](https://pub.dev/packages/sentry_isar) package provides `Isar` ## Instrumentation Behaviour -The created spans will be attached to the transaction on the scope. If no transaction is on the scope the Isar span will not be sent to Sentry. +The created spans attach to the active span. In transaction mode, that's the transaction bound to the scope; in stream mode, it's the span started with `Sentry.startSpan()`. If no span is active, the Isar span won't be sent to Sentry. ## Prerequisites @@ -61,7 +63,7 @@ final isar = await SentryIsar.open( ### 1. Execute the Code -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} import 'package:path_provider/path_provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_isar/sentry_isar.dart'; @@ -96,6 +98,39 @@ Future runApp() async { } ``` +```dart {tabTitle:Stream Mode} +import 'package:path_provider/path_provider.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; +import 'package:sentry_isar/sentry_isar.dart'; + +import 'user.dart'; // Import your Isar model instead + +Future runApp() async { + await Sentry.startSpan('isarTest', (span) async { + final dir = await getApplicationDocumentsDirectory(); + + final isar = await SentryIsar.open( + [UserSchema], + directory: dir.path, + ); + + final newUser = User() + ..name = 'Joe Dirt' + ..age = 36; + + await isar.writeTxn(() async { + await isar.users.put(newUser); // insert & update + }); + + final existingUser = await isar.users.get(newUser.id); // get + + await isar.writeTxn(() async { + await isar.users.delete(existingUser!.id); // delete + }); + }, parentSpan: null); +} +``` + ### 2. View the Transaction on Sentry.io To view the recorded transaction, log into [sentry.io](https://sentry.io). Use the left sidebar to navigate to the **Performance** page. Select your project and scroll down to the transactions table to see the just recorded transaction with the name `isarTest`. You can also use the search bar to find the transaction. Click on the transaction to open its **Transaction Summary** page for more performance details. diff --git a/includes/dart-integrations/routing-instrumentation.mdx b/includes/dart-integrations/routing-instrumentation.mdx index a77406e697b44..2fdc67e23d51a 100644 --- a/includes/dart-integrations/routing-instrumentation.mdx +++ b/includes/dart-integrations/routing-instrumentation.mdx @@ -10,6 +10,8 @@ platforms: - flutter --- + + Sentry's routing instrumentation for Flutter automatically tracks and reports page navigation events in your app. It supports imperative navigation (`Navigator.push()`), the declarative `Router` API (`MaterialApp.router`), and popular routing packages like [GoRouter](https://pub.dev/packages/go_router) and [auto_route](https://pub.dev/packages/auto_route). diff --git a/includes/dart-integrations/slow-and-frozen-frames-instrumentation.mdx b/includes/dart-integrations/slow-and-frozen-frames-instrumentation.mdx index 00183212386a3..bceaec6a7a907 100644 --- a/includes/dart-integrations/slow-and-frozen-frames-instrumentation.mdx +++ b/includes/dart-integrations/slow-and-frozen-frames-instrumentation.mdx @@ -10,6 +10,8 @@ platforms: - flutter --- + + Unresponsive UI and animation hitches annoy users and degrade the user experience. This integration can help. Set it up and identify these problems in your app by tracking and showing **slow frames**, **frozen frames**, and **frame delay** metrics for spans. Learn more about frame delay [here](https://develop.sentry.dev/sdk/performance/frames-delay/). diff --git a/includes/dart-integrations/sqflite-instrumentation.mdx b/includes/dart-integrations/sqflite-instrumentation.mdx index 94e8a34a5cefb..0b068609aedfa 100644 --- a/includes/dart-integrations/sqflite-instrumentation.mdx +++ b/includes/dart-integrations/sqflite-instrumentation.mdx @@ -10,6 +10,8 @@ platforms: - flutter --- + + _(New in version 7.2.0)_ @@ -18,7 +20,7 @@ The [sentry_sqflite](https://pub.dev/packages/sentry_sqflite) package provides ` ## Instrumentation Behaviour -- The created spans will be attached to the transaction on the scope - if no transaction is on the scope the sqflite span will not be sent to Sentry. +- The created spans attach to the active span. In transaction mode, that's the transaction bound to the scope; in stream mode, it's the span started with `Sentry.startSpan()`. If no span is active, the sqflite span won't be sent to Sentry. - The spans' `operation` are either `db`, `db.sql.execute`, `db.sql.query` or `db.sql.transaction`. Its `description` is the SQL statement using placeholders instead of its values due to the possibility of containing PII. ## Prerequisites @@ -94,7 +96,7 @@ final sentryDatabase = SentryDatabase(database); ### 1. Execute the Code -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} import 'package:sentry_sqflite/sentry_sqflite.dart'; import 'package:sqflite/sqflite.dart'; @@ -133,6 +135,39 @@ Future sqfliteTest() async { } ``` +```dart {tabTitle:Stream Mode} +import 'package:sentry_sqflite/sentry_sqflite.dart'; +import 'package:sqflite/sqflite.dart'; + +Future sqfliteTest() async { + await Sentry.startSpan('sqfliteTest', (span) async { + // You can also use the other configuration methods + final db = await openDatabaseWithSentry(inMemoryDatabasePath); + + await db.execute('''CREATE TABLE Product (id INTEGER PRIMARY KEY,title TEXT)'''); + final dbTitles = []; + for (int i = 1; i <= 20; i++) { + final title = 'Product $i'; + dbTitles.add(title); + await db.insert('Product', {'title': title}); + } + + await db.query('Product'); + + await db.transaction((txn) async { + await txn + .insert('Product', {'title': 'Product Another one'}); + await txn.delete('Product', + where: 'title = ?', whereArgs: ['Product Another one']); + }); + + await db.delete('Product', where: 'title = ?', whereArgs: ['Product 1']); + + await db.close(); + }, parentSpan: null); +} +``` + ### 2. View the Transaction on Sentry To view the recorded transaction, log into [sentry.io](https://sentry.io) and open your project (via main navigation menu Dashboards). diff --git a/includes/dart-integrations/user-interaction-instrumentation.mdx b/includes/dart-integrations/user-interaction-instrumentation.mdx index 2c95fc3c8a326..acfb12b0dfcc4 100644 --- a/includes/dart-integrations/user-interaction-instrumentation.mdx +++ b/includes/dart-integrations/user-interaction-instrumentation.mdx @@ -10,6 +10,8 @@ platforms: - flutter --- + + _(New in version 6.17.0)_ Enabling UI instrumentation captures transactions and adds breadcrumbs for a set of different user interactions, which include clicks, long clicks, taps, and so on. @@ -50,7 +52,7 @@ Future main() async { If the view doesn't have the key assigned, the transaction and the breadcrumb won't be captured because it can't be uniquely identified. The key value should be unique across the whole application because the transactions are grouped by its name. -```dart +```dart {tabTitle:Transaction Mode (Default)} {mdExpandTabs} ElevatedButton( key: const Key('my_button_widget'), onPressed: () { @@ -61,6 +63,18 @@ ElevatedButton( ), ``` +```dart {tabTitle:Stream Mode} +ElevatedButton( + key: const Key('my_button_widget'), + onPressed: () async { + // The tap starts a root span automatically; nested spans attach to it + await Sentry.startSpan('some operation', (span) async { + // your operation + }); + }, child: const Text('User Interaction Example'), +), +``` + ## Verify Tap on the button specified in step 2 of the configure section, wait for `idleTimeout` seconds (default is 3s) then check the performance page for a new transaction called `my_button_widget`. @@ -141,7 +155,9 @@ The `idleTimeoout` defaults to `3000` milliseconds (3 seconds). You can also disable the idle timeout by setting it to `null`, but if you do, you must finish the transaction manually. -To finish the transaction manually, use `Sentry.getSpan()` to retrieve the active transaction on the scope: +In stream mode, there's no public accessor for the active span, so manual finishing isn't available — keep the idle timeout enabled so the span finishes automatically. + +To finish the transaction manually in transaction mode, use `Sentry.getSpan()` to retrieve the active transaction on the scope: ```dart import 'package:sentry/sentry.dart'; diff --git a/includes/dart-stream-mode-general-callout.mdx b/includes/dart-stream-mode-general-callout.mdx new file mode 100644 index 0000000000000..c6229e9efda80 --- /dev/null +++ b/includes/dart-stream-mode-general-callout.mdx @@ -0,0 +1,5 @@ + + +References to "transactions" on this page apply to the default transaction mode. In stream mode, transactions become service spans that stream as they finish. See Streamed Spans for more information. + +