From c55afc9a3947177f64e738e8f0c2ec6791f9dd51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Andra=C5=A1ec?= Date: Thu, 13 Jan 2022 17:19:31 +0100 Subject: [PATCH 1/7] Add auto transactions documentation --- .../automatic-instrumentation.mdx | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx index fb2bfe7f15ccf..c02b3f2b491d8 100644 --- a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx +++ b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx @@ -23,3 +23,50 @@ The span finishes once the request has been executed. The span `status` depends When the HTTP request throws an `Exception`, Sentry's SDK associates this exception to the running span. If you haven't set the SDK to swallow the exception and capture it, the span and SentryEvent will be linked when viewing it on the **Issue Details** page in sentry.io. For more information see our [SentryHttpClient integration](/platforms/dart/usage/advanced-usage/#performance-monitoring-for-http-requests). + +### Routing Instumentation + + + +Supported in Sentry's Dart SDK version `6.3.0-beta.1` and above. + + + +We currently provide routing instrumentation by implementing `RouteObserver>`. This can be enabled by adding an instance of `SentryNavigationObserver` to your applications `navigatorObservers`. + +```dart +return MaterialApp( + title: 'Home', + home: HomeScreen(), + navigatorObservers: [ + SentryNavigatorObserver() + ], +); +``` + +The main route of your application will have the name `root "/"`. In order for transactions to be created automatically when navigation changes, you need to provide route names through your routes setttings parameter. + +```dart +MaterialPageRoute( + builder: (BuildContext context) => Settings(), + settings: RouteSettings(name: 'Settings'), +) +``` + +The SDK sets the span `operation` to `navigation` and the `name` to the one provided in `RouteSettings`. + +Transactions will be bound to the scope, if no other transaction is currently bound to it. + +The started transactions will idle for a fixed amount of time, currently set to `three seconds`. + +Child spans started will be attached to the transaction. If they run longer than the idle time, the transaction will be extended and finished when all its children are done. + +You can also opt out of this behaviour by setting `enableAutoTransactions` to false in the `SentryNavigatorObserver` constructor. You might do this when you only want to use navigation breadcrumbs, which can be enabled by setting the constructor parameter `setRouteNameAsTransaction` to `true`. + +```dart +/// Only track navigation breadcrums +SentryNavigatorObserver( + enableAutoTransactions: false, + setRouteNameAsTransaction: true +) +``` From e1f2abd79bcb7775bb243fd42a3291e4918a598e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Andra=C5=A1ec?= Date: Thu, 13 Jan 2022 17:28:13 +0100 Subject: [PATCH 2/7] Simplify first paragraph --- .../performance/instrumentation/automatic-instrumentation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx index c02b3f2b491d8..75cc21afb4b93 100644 --- a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx +++ b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx @@ -32,7 +32,7 @@ Supported in Sentry's Dart SDK version `6.3.0-beta.1` and above. -We currently provide routing instrumentation by implementing `RouteObserver>`. This can be enabled by adding an instance of `SentryNavigationObserver` to your applications `navigatorObservers`. +Automatic routing instrumentation can be enabled by adding an instance of `SentryNavigationObserver` to your applications `navigatorObservers`. transactions are started automatically when routing to new pages in your application. ```dart return MaterialApp( From 2a8d4b246e54f6230fafd6cb2aa02a5de319aa58 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 13 Jan 2022 20:51:39 +0100 Subject: [PATCH 3/7] Update src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- .../performance/instrumentation/automatic-instrumentation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx index 75cc21afb4b93..3881df7826dfd 100644 --- a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx +++ b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx @@ -32,7 +32,7 @@ Supported in Sentry's Dart SDK version `6.3.0-beta.1` and above. -Automatic routing instrumentation can be enabled by adding an instance of `SentryNavigationObserver` to your applications `navigatorObservers`. transactions are started automatically when routing to new pages in your application. +Automatic routing instrumentation can be enabled by adding an instance of `SentryNavigationObserver` to your application's `navigatorObservers`. Transactions are started automatically when routing to new pages in your application. ```dart return MaterialApp( From 432112d3a63c3507c7f4a9037d875376ab1c6401 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 13 Jan 2022 20:51:44 +0100 Subject: [PATCH 4/7] Update src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- .../performance/instrumentation/automatic-instrumentation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx index 3881df7826dfd..0b946dd93f31c 100644 --- a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx +++ b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx @@ -55,7 +55,7 @@ MaterialPageRoute( The SDK sets the span `operation` to `navigation` and the `name` to the one provided in `RouteSettings`. -Transactions will be bound to the scope, if no other transaction is currently bound to it. +Transactions will be bound to the scope if no other transaction is currently bound to it. The started transactions will idle for a fixed amount of time, currently set to `three seconds`. From ab083a2b2be35bd18ca8c6700a80a12fa5c5d712 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 13 Jan 2022 20:51:48 +0100 Subject: [PATCH 5/7] Update src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- .../performance/instrumentation/automatic-instrumentation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx index 0b946dd93f31c..7784350c42803 100644 --- a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx +++ b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx @@ -57,7 +57,7 @@ The SDK sets the span `operation` to `navigation` and the `name` to the one prov Transactions will be bound to the scope if no other transaction is currently bound to it. -The started transactions will idle for a fixed amount of time, currently set to `three seconds`. +The started transactions will idle for a fixed amount of time, for which the default is `three seconds`. Child spans started will be attached to the transaction. If they run longer than the idle time, the transaction will be extended and finished when all its children are done. From 789788d08a925414799da8eab97b7987aacea18d Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Thu, 13 Jan 2022 20:51:52 +0100 Subject: [PATCH 6/7] Update src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- .../performance/instrumentation/automatic-instrumentation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx index 7784350c42803..2431b10fb5524 100644 --- a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx +++ b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx @@ -59,7 +59,7 @@ Transactions will be bound to the scope if no other transaction is currently bou The started transactions will idle for a fixed amount of time, for which the default is `three seconds`. -Child spans started will be attached to the transaction. If they run longer than the idle time, the transaction will be extended and finished when all its children are done. +Child spans started will be attached to the transaction. If they run longer than the idle time, the transaction will be extended and finished when all its children are complete. You can also opt out of this behaviour by setting `enableAutoTransactions` to false in the `SentryNavigatorObserver` constructor. You might do this when you only want to use navigation breadcrumbs, which can be enabled by setting the constructor parameter `setRouteNameAsTransaction` to `true`. From a749a79806df3053a154403def200c5e44c5fa8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Andra=C5=A1ec?= Date: Mon, 17 Jan 2022 14:58:51 +0100 Subject: [PATCH 7/7] add imports in samples --- .../instrumentation/automatic-instrumentation.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx index 2431b10fb5524..5d4229d6c192e 100644 --- a/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx +++ b/src/platforms/flutter/common/performance/instrumentation/automatic-instrumentation.mdx @@ -35,6 +35,9 @@ Supported in Sentry's Dart SDK version `6.3.0-beta.1` and above. Automatic routing instrumentation can be enabled by adding an instance of `SentryNavigationObserver` to your application's `navigatorObservers`. Transactions are started automatically when routing to new pages in your application. ```dart +import 'package:flutter/material.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; + return MaterialApp( title: 'Home', home: HomeScreen(), @@ -47,6 +50,8 @@ return MaterialApp( The main route of your application will have the name `root "/"`. In order for transactions to be created automatically when navigation changes, you need to provide route names through your routes setttings parameter. ```dart +import 'package:flutter/material.dart'; + MaterialPageRoute( builder: (BuildContext context) => Settings(), settings: RouteSettings(name: 'Settings'),