Skip to content

Commit

Permalink
Add (not all) improvements for pr review
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Mar 5, 2024
1 parent 4dedf37 commit 5dd824e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 30 deletions.
14 changes: 14 additions & 0 deletions dart/lib/src/sentry_measurement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ class SentryMeasurement {
value = duration.inMilliseconds,
unit = DurationSentryMeasurementUnit.milliSecond;

/// Duration of the time to initial display in milliseconds
SentryMeasurement.timeToInitialDisplay(Duration duration) :
assert(!duration.isNegative),
name = 'time_to_initial_display',
value = duration.inMilliseconds,
unit = DurationSentryMeasurementUnit.milliSecond;

/// Duration of the time to full display in milliseconds
SentryMeasurement.timeToFullDisplay(Duration duration) :
assert(!duration.isNegative),
name = 'time_to_full_display',
value = duration.inMilliseconds,
unit = DurationSentryMeasurementUnit.milliSecond;

final String name;
final num value;
final SentryMeasurementUnit? unit;
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 @@ -221,7 +221,7 @@ class SentryNavigatorObserver extends RouteObserver<PageRoute<dynamic>> {

final arguments = route?.settings.arguments;
await _timeToDisplayTracker?.startTracking(routeName, arguments);
completedDisplayTracking?.complete();
_completedDisplayTracking?.complete();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import '../integrations/integrations.dart';

import '../../sentry_flutter.dart';
import '../frame_callback_handler.dart';
import '../sentry_flutter_measurement.dart';

@internal
class TimeToInitialDisplayTracker {
Expand Down Expand Up @@ -49,10 +48,8 @@ class TimeToInitialDisplayTracker {
ttidSpan.origin = SentryTraceOrigins.autoUiTimeToDisplay;
}

final ttidMeasurement = SentryFlutterMeasurement.timeToInitialDisplay(
Duration(
milliseconds:
endTimestamp.difference(startTimestamp).inMilliseconds));
final ttidMeasurement = SentryMeasurement.timeToInitialDisplay(Duration(
milliseconds: endTimestamp.difference(startTimestamp).inMilliseconds));
transaction.setMeasurement(ttidMeasurement.name, ttidMeasurement.value,
unit: ttidMeasurement.unit);
await ttidSpan.finish(endTimestamp: endTimestamp);
Expand All @@ -68,7 +65,7 @@ class TimeToInitialDisplayTracker {
ttidSpan.origin = SentryTraceOrigins.autoUiTimeToDisplay;

final ttidMeasurement =
SentryFlutterMeasurement.timeToInitialDisplay(appStartInfo.duration);
SentryMeasurement.timeToInitialDisplay(appStartInfo.duration);
transaction.setMeasurement(ttidMeasurement.name, ttidMeasurement.value,
unit: ttidMeasurement.unit);

Expand Down
23 changes: 0 additions & 23 deletions flutter/lib/src/sentry_flutter_measurement.dart

This file was deleted.

0 comments on commit 5dd824e

Please sign in to comment.