Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Oct 11, 2024
1 parent ad09517 commit f3c3971
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ Navigator.push(
- iOS replay integration when only `onErrorSampleRate` is specified ([#2306](https://github.com/getsentry/sentry-dart/pull/2306))
- Fix TTID timing issue ([#2326](https://github.com/getsentry/sentry-dart/pull/2326))
- Start missing TTFD for root screen transaction ([#2332](https://github.com/getsentry/sentry-dart/pull/2332))
- Unfinished TTID or TTFD spans should be set to status `cancelled` ([#2347](https://github.com/getsentry/sentry-dart/pull/2347))
- This might happen if a user navigates to another screen while either span is unfinished
- Match TTFD to TTID end timespan if TTFD is unfinished when user navigates to another screen ([#2347](https://github.com/getsentry/sentry-dart/pull/2347))
- Accessing invalid json fields from `fetchNativeAppStart` should return null ([#2340](https://github.com/getsentry/sentry-dart/pull/2340))
- Error when calling `SentryFlutter.reportFullyDisplayed()` twice ([#2339](https://github.com/getsentry/sentry-dart/pull/2339))

Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/navigation/sentry_navigator_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class SentryNavigatorObserver extends RouteObserver<PageRoute<dynamic>> {
: endTimestamp;
await child.finish(
endTimestamp: finishTimestamp,
status: SpanStatus.cancelled(),
status: SpanStatus.deadlineExceeded(),
);
}
}
Expand Down
19 changes: 11 additions & 8 deletions flutter/test/sentry_navigator_observer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ void main() {
.called(1);
});

// e.g when a user navigates to another screen before ttfd or ttid is finished
test('cancelled TTID and TTFD spans do not add measurements', () async {
final initialRoute = route(RouteSettings(name: 'Initial Route'));
final newRoute = route(RouteSettings(name: 'New Route'));
Expand Down Expand Up @@ -443,11 +444,11 @@ void main() {
// Verify that the TTID and TTFD spans are finished with a cancelled status
verify(mockChildTTID.finish(
endTimestamp: anyNamed('endTimestamp'),
status: SpanStatus.cancelled()))
status: SpanStatus.deadlineExceeded()))
.called(1);
verify(mockChildTTFD.finish(
endTimestamp: anyNamed('endTimestamp'),
status: SpanStatus.cancelled()))
status: SpanStatus.deadlineExceeded()))
.called(1);

// Verify that the measurements are not added to the transaction
Expand All @@ -456,7 +457,8 @@ void main() {
expect(measurements.containsKey('time_to_full_display'), isFalse);
});

test('unfinished children will be finished with cancelled on didPush',
test(
'unfinished children will be finished with deadline_exceeded on didPush',
() async {
final currentRoute = route(RouteSettings(name: 'Current Route'));

Expand Down Expand Up @@ -491,15 +493,16 @@ void main() {

verify(mockChildA.finish(
endTimestamp: captureAnyNamed('endTimestamp'),
status: SpanStatus.cancelled()))
status: SpanStatus.deadlineExceeded()))
.called(1);
verify(mockChildB.finish(
endTimestamp: captureAnyNamed('endTimestamp'),
status: SpanStatus.cancelled()))
status: SpanStatus.deadlineExceeded()))
.called(1);
});

test('unfinished children will be finished with cancelled on didPop',
test(
'unfinished children will be finished with deadline_exceeded on didPop',
() async {
final currentRoute = route(RouteSettings(name: 'Current Route'));

Expand Down Expand Up @@ -537,11 +540,11 @@ void main() {

verify(mockChildA.finish(
endTimestamp: captureAnyNamed('endTimestamp'),
status: SpanStatus.cancelled()))
status: SpanStatus.deadlineExceeded()))
.called(1);
verify(mockChildB.finish(
endTimestamp: captureAnyNamed('endTimestamp'),
status: SpanStatus.cancelled()))
status: SpanStatus.deadlineExceeded()))
.called(1);
});

Expand Down

0 comments on commit f3c3971

Please sign in to comment.