-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change app start integration in a way that works with ttid as well * Formatting * Update * add visibleForTesting * Update * update * Add app start info test * Remove set app start info null * Review improvements * Add TTID * Improvements * Improvements * Fix integration test * Update * Clear after tracking * Update CHANGELOG * Format * Update * Update * remove import * Update sentry tracer * Add (not all) improvements for pr review * combine transaction handler * Refactor trackAppStart and trackRegularRoute to use private method * Fix dart analyzer * Remove clear * Clear in tearDown * Apply suggestions from code review Co-authored-by: Philipp Hofmann <[email protected]> * Apply PR suggestions * fix analyze * update * update * Fix tests * Fix analyze * revert sample * Update * Update * Fix test * Move clear to the beginning of function * Fix start time * Fix analyze * remove comment * Formatting * fix test * add ttid duration assertion and determineEndTime timeout * Rename finish transaction and do an early exit with enableAutoTransactions * Rename function * Remove static and getter for in navigator observer * Expose SentryDisplayWidget as public api and add it to example app * Fix dart analyze * Fix dart doc * Improve tests * Reduce fake frame finishing time and improve tests * Improve test names * Fix tests * Apply formatting * Add extra assertion in tests --------- Co-authored-by: Philipp Hofmann <[email protected]>
- Loading branch information
1 parent
1d9ee98
commit 31b2afb
Showing
18 changed files
with
961 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import 'package:meta/meta.dart'; | ||
|
||
@internal | ||
class SentrySpanOperations { | ||
static const String uiLoad = 'ui.load'; | ||
static const String uiTimeToInitialDisplay = 'ui.load.initial_display'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'time_to_initial_display_tracker.dart'; | ||
|
||
import '../frame_callback_handler.dart'; | ||
|
||
/// A widget that reports the Time To Initially Displayed (TTID) of its child widget. | ||
/// | ||
/// This widget wraps around another widget to measure and report the time it takes | ||
/// for the child widget to be initially displayed on the screen. This method | ||
/// allows a more accurate measurement than what the default TTID implementation | ||
/// provides. The TTID measurement begins when the route to the widget is pushed and ends | ||
/// when `addPostFramecallback` is triggered. | ||
/// | ||
/// Wrap the widget you want to measure with [SentryDisplayWidget], and ensure that you | ||
/// have set up Sentry's routing instrumentation according to the Sentry documentation. | ||
/// | ||
/// ```dart | ||
/// SentryDisplayWidget( | ||
/// child: MyWidget(), | ||
/// ) | ||
/// ``` | ||
/// | ||
/// Make sure to configure Sentry's routing instrumentation in your app by following | ||
/// the guidelines provided in Sentry's documentation for Flutter integrations: | ||
/// https://docs.sentry.io/platforms/flutter/integrations/routing-instrumentation/ | ||
/// | ||
/// See also: | ||
/// - [Sentry's documentation on Flutter integrations](https://docs.sentry.io/platforms/flutter/) | ||
/// for more information on how to integrate Sentry into your Flutter application. | ||
class SentryDisplayWidget extends StatefulWidget { | ||
final Widget child; | ||
final FrameCallbackHandler _frameCallbackHandler; | ||
|
||
SentryDisplayWidget({ | ||
super.key, | ||
required this.child, | ||
@visibleForTesting FrameCallbackHandler? frameCallbackHandler, | ||
}) : _frameCallbackHandler = | ||
frameCallbackHandler ?? DefaultFrameCallbackHandler(); | ||
|
||
@override | ||
_SentryDisplayWidgetState createState() => _SentryDisplayWidgetState(); | ||
} | ||
|
||
class _SentryDisplayWidgetState extends State<SentryDisplayWidget> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
TimeToInitialDisplayTracker().markAsManual(); | ||
|
||
widget._frameCallbackHandler.addPostFrameCallback((_) { | ||
TimeToInitialDisplayTracker().completeTracking(); | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return widget.child; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.