-
-
Notifications
You must be signed in to change notification settings - Fork 239
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 <philipp.hofmann@sentry.io> * Apply PR suggestions * fix analyze * update * update * Fix tests * Fix analyze * revert sample * Update * Update * Fix child timestamp trimming * Update CHANGELOG * Run formatting * Update docs * Revert * Fix test * Move clear to the beginning of function * initial commit * Fix start time * Fix analyze * remove comment * Formatting * update * fix test * Add changelog * Update * Update * fix analyze * fix tests * formatting * 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 * Get display tracker as static for reportFullyDisplayed() * Add @internal * Fix test * Improve tests * Reduce fake frame finishing time and improve tests * Improve test names * Fix tests * Apply formatting * Add extra assertion in tests * Improve * Use utc date time * Fix test * Fix dartdoc * Update test * Update test * Fix tests * Fix changelog * Update * Improve * Update * Improve tests * Update * Change function to private * Update CHANGELOG.md * Rename function * add improvements (not all) * Fix tests * Update changelog * Finish after setting scope span to null * update * updaet * update * clear first in didPush * update * update example * add improvements --------- Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
- Loading branch information
1 parent
e8603bb
commit d089990
Showing
16 changed files
with
886 additions
and
125 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
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 |
---|---|---|
@@ -1,34 +1,55 @@ | ||
// ignore_for_file: invalid_use_of_internal_member | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:meta/meta.dart'; | ||
|
||
import '../../sentry_flutter.dart'; | ||
import 'time_to_full_display_tracker.dart'; | ||
import 'time_to_initial_display_tracker.dart'; | ||
|
||
@internal | ||
class TimeToDisplayTracker { | ||
final TimeToInitialDisplayTracker _ttidTracker; | ||
final TimeToFullDisplayTracker? _ttfdTracker; | ||
final bool enableTimeToFullDisplayTracing; | ||
|
||
TimeToDisplayTracker({ | ||
TimeToInitialDisplayTracker? ttidTracker, | ||
}) : _ttidTracker = ttidTracker ?? TimeToInitialDisplayTracker(); | ||
TimeToFullDisplayTracker? ttfdTracker, | ||
required this.enableTimeToFullDisplayTracing, | ||
}) : _ttidTracker = ttidTracker ?? TimeToInitialDisplayTracker(), | ||
_ttfdTracker = enableTimeToFullDisplayTracing | ||
? ttfdTracker ?? TimeToFullDisplayTracker() | ||
: null; | ||
|
||
Future<void> trackAppStartTTD(ISentrySpan transaction, | ||
{required DateTime startTimestamp, | ||
required DateTime endTimestamp}) async { | ||
// We start and immediately finish the spans since we cannot mutate the history of spans. | ||
await _ttidTracker.trackAppStart(transaction, | ||
startTimestamp: startTimestamp, endTimestamp: endTimestamp); | ||
await _trackTTFDIfEnabled(transaction, startTimestamp); | ||
} | ||
|
||
Future<void> trackRegularRouteTTD(ISentrySpan transaction, | ||
{required DateTime startTimestamp}) async { | ||
await _ttidTracker.trackRegularRoute(transaction, startTimestamp); | ||
await _trackTTFDIfEnabled(transaction, startTimestamp); | ||
} | ||
|
||
Future<void> _trackTTFDIfEnabled( | ||
ISentrySpan transaction, DateTime startTimestamp) async { | ||
if (enableTimeToFullDisplayTracing) { | ||
await _ttfdTracker?.track(transaction, startTimestamp); | ||
} | ||
} | ||
|
||
@internal | ||
Future<void> reportFullyDisplayed() async { | ||
return _ttfdTracker?.reportFullyDisplayed(); | ||
} | ||
|
||
void clear() { | ||
_ttidTracker.clear(); | ||
_ttfdTracker?.clear(); | ||
} | ||
} |
Oops, something went wrong.