You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/flutter/integrations/app-start-instrumentation.mdx
+23-39Lines changed: 23 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,28 @@ categories:
10
10
11
11
Sentry's app start instrumentation provides insight into how long your application takes to launch.
12
12
13
+
<Note>
14
+
15
+
App start instrumentation is available on **iOS** and **Android**.
16
+
17
+
</Note>
18
+
13
19
## Instrumentation Behaviour
14
20
15
21
Before diving into the configuration, it's important to understand how app start instrumentation behaves:
16
22
17
-
- The SDK attaches the app start metrics to the **first run transaction**.
18
-
- It tracks the length of time from the **earliest native process initialization** until the very first [PostFrameCallback](https://api.flutter.dev/flutter/scheduler/SchedulerBinding/addPostFrameCallback.html) is triggered.
19
-
- The SDK differentiates between a cold and a warm start, but doesn't track hot starts/resumes.
23
+
App start instrumentation tracks the duration between the earliest native process initialization and the first frame rendered (as reported by [addTimingsCallback](https://api.flutter.dev/flutter/scheduler/SchedulerBinding/addTimingsCallback.html)). Once the app start is processed, the callback is removed to avoid additional overhead.
24
+
25
+
When the SDK receives the start and end times of the app launch, the SDK:
26
+
- Creates a transaction named `ui.load`
27
+
- Attaches a span with either `app.start.cold` or `app.start.warm` operation
28
+
- Adds app start metrics to the transaction
29
+
30
+
<Note>
31
+
32
+
While the SDK differentiates between cold and warm starts, it doesn't track hot starts/resumes.
33
+
34
+
</Note>
20
35
21
36
## Prerequisites
22
37
@@ -27,49 +42,18 @@ Before starting, ensure:
27
42
28
43
## Configure
29
44
30
-
This type of instrumentation is automatically enabled. There is no need for further configuration.
45
+
This instrumentation is automatically enabled. There is no need for further configuration.
31
46
32
47
## Verify
33
48
34
-
### 1. Execute the Transaction:
35
-
36
-
Initiate a transaction immediately after the app launches.
49
+
### 1. Launch Your App:
37
50
38
-
```dart
39
-
import 'package:sentry/sentry.dart';
40
-
41
-
final transaction = Sentry.startTransaction("test test", "my operation");
Open the [sentry.io](https://sentry.io/)performance dashboard, find, and select the transaction you executed.
55
+
Open the [sentry.io performance page](https://sentry.io/performance), find, and select the 'root /' transaction and navigate to the trace view of a sampled event.
49
56
50
57
### 3. View App Start Metrics:
51
58
52
-
Select the event within your transaction. Sentry.io displays the app start metrics on the right side of the screen.
53
-
54
-
## Additional Configuration
55
-
56
-
### Change App Start Tracking End
57
-
58
-
1. Set `autoAppStart` to `false` in the Sentry options.
Copy file name to clipboardExpand all lines: docs/platforms/flutter/integrations/slow-and-frozen-frames-instrumentation.mdx
+32-13Lines changed: 32 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,17 @@ Unresponsive UI and animation hitches annoy users and degrade the user experienc
12
12
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.
13
13
Learn more about frame delay [here](https://develop.sentry.dev/sdk/performance/frames-delay/).
14
14
15
+
<Note>
16
+
17
+
Frames tracking instrumentation is available on **iOS**, **macOS** and **Android**.
18
+
19
+
</Note>
20
+
15
21
## Instrumentation Behaviour
16
22
17
-
Frame metrics are manually calculated using the [addPersistentFrameCallback](https://api.flutter.dev/flutter/scheduler/SchedulerBinding/addPersistentFrameCallback.html) API from the Flutter SDK.
18
-
Frame duration tracking in Sentry's Flutter SDK begins automatically when a span starts. It continuously measures each frame's render time until the span finishes, then calculates and attaches frame metrics to the completed span.
23
+
The frames tracking instrumentation measures frame metrics (slow frames, frozen frames, and frame delay) for each span. To calculate these metrics, the SDK uses a custom `WidgetsFlutterBinding` that measures the duration between [handleBeginFrame](https://api.flutter.dev/flutter/scheduler/SchedulerBinding/handleBeginFrame.html) and [handleDrawFrame](https://api.flutter.dev/flutter/scheduler/SchedulerBinding/handleDrawFrame.html) to determine each frame's render time.
24
+
25
+
Frame duration tracking begins automatically when a span starts. The integration continuously measures frame durations until the span finishes, then calculates and attaches the frame metrics to the completed span.
19
26
20
27
## Prerequisite
21
28
@@ -26,22 +33,34 @@ Before starting, ensure:
26
33
27
34
## Configure
28
35
29
-
This type of instrumentation is automatically enabled. There is no need for further configuration.
36
+
This instrumentation is automatically enabled through two integrations:
37
+
- The `WidgetsFlutterBindingIntegration` which provides the custom binding for frame tracking
38
+
- The `FramesTrackingIntegration` which processes and attaches the frame metrics to spans
39
+
40
+
In most cases, no additional configuration is required.
41
+
42
+
### Early Widgets Binding Initialization
43
+
44
+
If you need to initialize the widgets binding earlier than `SentryFlutter.init()`, you must call `SentryWidgetsFlutterBinding.ensureInitialized()` manually. Note that using a different custom binding will prevent this instrumentation from working properly.
45
+
46
+
Example:
47
+
```dart {2}
48
+
void main() {
49
+
SentryWidgetsFlutterBinding.ensureInitialized();
50
+
// ... rest of your initialization code
51
+
}
52
+
```
30
53
31
54
## Additional Configuration
32
55
33
56
### Disabling the Instrumentation
34
57
35
58
Set `enableFramesTracking` to `false` in the options to disable the instrumentation.
0 commit comments