Skip to content

Commit deaeece

Browse files
authored
Missing slow and frozen frames for Auto transactions (#1172)
1 parent 1131914 commit deaeece

File tree

8 files changed

+23
-16
lines changed

8 files changed

+23
-16
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- Missing slow and frozen frames for Auto transactions ([#1172](https://github.com/getsentry/sentry-dart/pull/1172))
8+
59
### Dependencies
610

711
- Bump Android SDK from v6.9.1 to v6.9.2 ([#1167](https://github.com/getsentry/sentry-dart/pull/1167))

dart/lib/src/hub_adapter.dart

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class HubAdapter implements Hub {
129129
waitForChildren: waitForChildren,
130130
autoFinishAfter: autoFinishAfter,
131131
trimEnd: trimEnd,
132+
onFinish: onFinish,
132133
);
133134

134135
@override

dart/lib/src/protocol/sentry_span.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import '../sentry_tracer.dart';
77
import '../tracing.dart';
88
import '../utils.dart';
99

10+
typedef OnFinishedCallback = Future<void> Function({DateTime? endTimestamp});
11+
1012
class SentrySpan extends ISentrySpan {
1113
final SentrySpanContext _context;
1214
DateTime? _endTimestamp;
@@ -19,7 +21,7 @@ class SentrySpan extends ISentrySpan {
1921

2022
SpanStatus? _status;
2123
final Map<String, String> _tags = {};
22-
Function({DateTime? endTimestamp})? _finishedCallback;
24+
OnFinishedCallback? _finishedCallback;
2325

2426
@override
2527
final SentryTracesSamplingDecision? samplingDecision;
@@ -30,7 +32,7 @@ class SentrySpan extends ISentrySpan {
3032
this._hub, {
3133
DateTime? startTimestamp,
3234
this.samplingDecision,
33-
Function({DateTime? endTimestamp})? finishedCallback,
35+
OnFinishedCallback? finishedCallback,
3436
}) {
3537
_startTimestamp = startTimestamp?.toUtc() ?? _hub.options.clock();
3638
_finishedCallback = finishedCallback;

dart/lib/src/scope.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import 'sentry_options.dart';
99
import 'sentry_span_interface.dart';
1010
import 'sentry_tracer.dart';
1111

12+
typedef _OnScopeObserver = Future<void> Function(ScopeObserver observer);
13+
1214
/// Scope data to be sent with the event
1315
class Scope {
1416
/// How important this event is.
@@ -445,8 +447,7 @@ class Scope {
445447
return clone;
446448
}
447449

448-
Future<void> _callScopeObservers(
449-
Future<void> Function(ScopeObserver) action) async {
450+
Future<void> _callScopeObservers(_OnScopeObserver action) async {
450451
if (_options.enableScopeSync) {
451452
for (final scopeObserver in _options.scopeObservers) {
452453
await action(scopeObserver);

dart/lib/src/sentry.dart

+2-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Sentry {
4141
@internal SentryOptions? options,
4242
}) async {
4343
final sentryOptions = options ?? SentryOptions();
44-
await _initDefaultValues(sentryOptions, appRunner);
44+
await _initDefaultValues(sentryOptions);
4545

4646
try {
4747
await optionsConfiguration(sentryOptions);
@@ -61,10 +61,7 @@ class Sentry {
6161
await _init(sentryOptions, appRunner, callAppRunnerInRunZonedGuarded);
6262
}
6363

64-
static Future<void> _initDefaultValues(
65-
SentryOptions options,
66-
AppRunner? appRunner,
67-
) async {
64+
static Future<void> _initDefaultValues(SentryOptions options) async {
6865
_setEnvironmentVariables(options);
6966

7067
// Throws when running on the browser

dart/lib/src/sentry_tracer.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class SentryTracer extends ISentrySpan {
2323
@visibleForTesting
2424
Timer? get autoFinishAfterTimer => _autoFinishAfterTimer;
2525

26-
Function(SentryTracer)? _onFinish;
26+
OnTransactionFinish? _onFinish;
2727
var _finishStatus = SentryTracerFinishStatus.notFinishing();
2828
late final bool _trimEnd;
2929

@@ -51,7 +51,7 @@ class SentryTracer extends ISentrySpan {
5151
bool waitForChildren = false,
5252
Duration? autoFinishAfter,
5353
bool trimEnd = false,
54-
Function(SentryTracer)? onFinish,
54+
OnTransactionFinish? onFinish,
5555
}) {
5656
_rootSpan = SentrySpan(
5757
this,

dart/test/sentry_span_test.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ void main() {
226226

227227
test('callback called on finish', () async {
228228
var numberOfCallbackCalls = 0;
229-
final sut = fixture.getSut(finishedCallback: ({DateTime? endTimestamp}) {
229+
final sut =
230+
fixture.getSut(finishedCallback: ({DateTime? endTimestamp}) async {
230231
numberOfCallbackCalls += 1;
231232
});
232233

@@ -269,7 +270,7 @@ class Fixture {
269270
SentrySpan getSut({
270271
DateTime? startTimestamp,
271272
bool? sampled = true,
272-
Function({DateTime? endTimestamp})? finishedCallback,
273+
OnFinishedCallback? finishedCallback,
273274
Duration? autoFinishAfter,
274275
}) {
275276
tracer = SentryTracer(context, hub, autoFinishAfter: autoFinishAfter);

flutter/lib/src/integrations/widgets_flutter_binding_integration.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import 'package:flutter/widgets.dart';
44
import 'package:sentry/sentry.dart';
55
import '../sentry_flutter_options.dart';
66

7+
typedef OnWidgetsBinding = WidgetsBinding Function();
8+
79
/// It is necessary to initialize Flutter method channels so that our plugin can
810
/// call into the native code.
911
class WidgetsFlutterBindingIntegration
1012
extends Integration<SentryFlutterOptions> {
11-
WidgetsFlutterBindingIntegration(
12-
[WidgetsBinding Function()? ensureInitialized])
13+
WidgetsFlutterBindingIntegration([OnWidgetsBinding? ensureInitialized])
1314
: _ensureInitialized =
1415
ensureInitialized ?? WidgetsFlutterBinding.ensureInitialized;
1516

16-
final WidgetsBinding Function() _ensureInitialized;
17+
final OnWidgetsBinding _ensureInitialized;
1718

1819
@override
1920
FutureOr<void> call(Hub hub, SentryFlutterOptions options) {

0 commit comments

Comments
 (0)