Skip to content

Commit 267cbb7

Browse files
authored
ThreadInfo integration should only be added for non-web platforms (#3144)
1 parent 2cb90b9 commit 267cbb7

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Tag all spans with thread info on non-web platforms ([#3101](https://github.com/getsentry/sentry-dart/pull/3101), [#3144](https://github.com/getsentry/sentry-dart/pull/3144))
8+
39
## 9.7.0-beta.1
410

511
### Features

packages/flutter/lib/src/sentry_flutter.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ mixin SentryFlutter {
230230

231231
integrations.add(DebugPrintIntegration());
232232

233-
integrations.add(ThreadInfoIntegration());
234-
233+
if (!platform.isWeb) {
234+
integrations.add(ThreadInfoIntegration());
235+
}
235236
return integrations;
236237
}
237238

packages/flutter/test/sentry_flutter_test.dart

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:sentry_flutter/src/integrations/connectivity/connectivity_integr
1212
import 'package:sentry_flutter/src/integrations/integrations.dart';
1313
import 'package:sentry_flutter/src/integrations/screenshot_integration.dart';
1414
import 'package:sentry_flutter/src/integrations/generic_app_start_integration.dart';
15+
import 'package:sentry_flutter/src/integrations/thread_info_integration.dart';
1516
import 'package:sentry_flutter/src/integrations/web_session_integration.dart';
1617
import 'package:sentry_flutter/src/profiling.dart';
1718
import 'package:sentry_flutter/src/renderer/renderer.dart';
@@ -45,6 +46,7 @@ final linuxWindowsAndWebIntegrations = [
4546

4647
final nonWebIntegrations = [
4748
OnErrorIntegration,
49+
ThreadInfoIntegration,
4850
];
4951

5052
// These should be added to Android
@@ -719,14 +721,34 @@ void main() {
719721
integration.runtimeType.toString() == 'ThreadInfoIntegration'),
720722
true,
721723
reason:
722-
'ThreadInfoIntegration should be added when tracing is enabled',
724+
'ThreadInfoIntegration should be added on non-web platforms',
723725
);
724726
},
725727
appRunner: appRunner,
726728
options: sentryFlutterOptions,
727729
);
728730
SentryFlutter.native = null;
729731
});
732+
733+
test('ThreadInfoIntegration is not added on web', () async {
734+
final sentryFlutterOptions =
735+
defaultTestOptions(checker: MockRuntimeChecker())
736+
..platform = MockPlatform.linux(isWeb: true)
737+
..methodChannel = native.channel;
738+
739+
await SentryFlutter.init(
740+
(options) {
741+
expect(
742+
options.integrations.any((integration) =>
743+
integration.runtimeType.toString() == 'ThreadInfoIntegration'),
744+
false,
745+
reason: 'ThreadInfoIntegration should not be added on web platform',
746+
);
747+
},
748+
appRunner: appRunner,
749+
options: sentryFlutterOptions,
750+
);
751+
}, testOn: 'browser');
730752
});
731753

732754
test('resumeAppHangTracking calls native method when available', () async {

0 commit comments

Comments
 (0)