Skip to content

Commit b160935

Browse files
committed
Merge branch 'v9' into v9-feat/replace-custom-platform-checker
# Conflicts: # dart/lib/src/platform/_io_platform.dart # dart/lib/src/platform/_web_platform.dart # dart/lib/src/platform/platform.dart # dart/lib/src/runtime_checker.dart # dart/test/mocks/mock_platform.dart # dart/test/mocks/mock_platform_checker.dart # flutter/test/mocks.dart # flutter/test/profiling_test.dart # flutter/test/sentry_flutter_test.dart # flutter/test/sentry_native_channel_test.dart
2 parents b80690d + dd80448 commit b160935

File tree

112 files changed

+1024
-718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1024
-718
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 🐞 Bug Report
22
description: Tell us about something that's not working the way we (probably) intend.
33
labels: ["Platform: Dart", "bug"]
4+
type: Bug
45
body:
56
- type: dropdown
67
id: environment
@@ -94,7 +95,7 @@ body:
9495
id: submit-a-pr
9596
attributes:
9697
label: Are you willing to submit a PR?
97-
description: We accept contributions!
98+
description: We accept contributions!
9899
options:
99100
- "Yes"
100101
- "No"

.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 💡 Feature Request
22
description: Tell us about a problem our SDK could solve but doesn't.
33
labels: ["Platform: Dart", "enhancement"]
4+
type: Feature
45
body:
56
- type: textarea
67
id: problem
@@ -24,7 +25,7 @@ body:
2425
id: submit-a-pr
2526
attributes:
2627
label: Are you willing to submit a PR?
27-
description: We accept contributions!
28+
description: We accept contributions!
2829
options:
2930
- "Yes"
3031
- "No"

.github/workflows/analyze.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
if: ${{ inputs.sdk == 'flutter' }}
3939

4040
- run: ${{ inputs.sdk }} pub get
41+
- run: ${{ inputs.sdk }} pub get
42+
if: ${{ inputs.package == 'flutter' }}
43+
working-directory: flutter/microbenchmarks
4144
- run: dart format --set-exit-if-changed ./
4245

4346
- name: dart analyze

.github/workflows/flutter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,6 @@ jobs:
180180
steps:
181181
- uses: actions/checkout@v4
182182
# To recreate baseline run: detekt -i flutter/android,flutter/example/android -b flutter/config/detekt-bl.xml -cb
183-
- uses: natiginfo/action-detekt-all@6bf4342ea96f638ecced05cf7d7dc48acdecc854 # [email protected].7
183+
- uses: natiginfo/action-detekt-all@45229fbbe47eaff1160b6c956d7ffe14dc23c206 # [email protected].8
184184
with:
185185
args: -i flutter/android,flutter/example/android --baseline flutter/config/detekt-bl.xml --jvm-target 1.8 --build-upon-default-config --all-rules

.github/workflows/min_version_test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ jobs:
5555
with:
5656
flutter-version: "3.24.0"
5757

58+
- uses: ruby/setup-ruby@277ba2a127aba66d45bad0fa2dc56f80dbfedffa # [email protected]
59+
with:
60+
ruby-version: '3.1.2' # https://github.com/flutter/flutter/issues/109385#issuecomment-1212614125
61+
62+
- name: Update Pods
63+
run: sudo gem update
5864
- name: Build iOS
5965
run: |
6066
cd min_version_test

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Get auth token
2121
id: token
22-
uses: actions/create-github-app-token@0d564482f06ca65fa9e77e2510873638c82206f2 # v1.11.5
22+
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6
2323
with:
2424
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
2525
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

.github/workflows/testflight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # [email protected]
1818
- run: xcodes select 15.0.1
19-
- uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # pin@v1.221.0
19+
- uses: ruby/setup-ruby@277ba2a127aba66d45bad0fa2dc56f80dbfedffa # pin@v1.222.0
2020
with:
2121
ruby-version: '2.7.5'
2222
bundler-cache: true

.github/workflows/web-example-ghpages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # [email protected]
18-
- uses: bluefireteam/flutter-gh-pages@57815b17b371455ec1a98f075b71b4c6ba0a938c # pin@v8
18+
- uses: bluefireteam/flutter-gh-pages@cf4a9312849577dbfd9df8f3d63d12ef6b09898e # pin@v9
1919
with:
2020
workingDir: flutter/example
2121
customArgs: --source-maps

CHANGELOG.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## Unreleased 9.0.0
44

5+
- Move replay and privacy from experimental to options ([#2755](https://github.com/getsentry/sentry-dart/pull/2755))
6+
- Remove renderer from `flutter_context` ([#2751](https://github.com/getsentry/sentry-dart/pull/2751))
7+
- Cleanup platform mocking ([#2730](https://github.com/getsentry/sentry-dart/pull/2730))
8+
- The `PlatformChecker` was renamed to `RuntimeChecker`
9+
- Moved `PlatformChecker.platform` to `options.platform`
10+
11+
## 9.0.0-alpha.1
12+
513
### Breaking changes
614

715
- Remove `SentryDisplayWidget` and manual TTID implementation ([#2668](https://github.com/getsentry/sentry-dart/pull/2668))
@@ -22,6 +30,7 @@
2230
- Responses are now only attached if size is below ~0.15mb
2331
- Responses are attached to the `Hint` object, which can be read in `beforeSend`/`beforeSendTransaction` callbacks via `hint.response`.
2432
- For now, only the `dio` integration is supported.
33+
- Enable privacy masking for screenshots by default ([#2728](https://github.com/getsentry/sentry-dart/pull/2728))
2534

2635
### Enhancements
2736

@@ -32,14 +41,39 @@
3241
- Bump Android SDK from v7.20.1 to v8.1.0 ([#2650](https://github.com/getsentry/sentry-dart/pull/2650))
3342
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#810)
3443
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...8.1.0)
35-
3644
## Unreleased
3745

46+
47+
### Enhancements
48+
49+
- Add Flutter runtime information ([#2742](https://github.com/getsentry/sentry-dart/pull/2742))
50+
- This works if the version of Flutter you're using includes [this code](https://github.com/flutter/flutter/pull/163761).
51+
52+
### Fixes
53+
54+
- Pass missing `captureFailedRequests` param to `FailedRequestInterceptor` ([#2744](https://github.com/getsentry/sentry-dart/pull/2744))
55+
56+
57+
## 8.14.0-beta.1
58+
59+
### Behavioral changes
60+
61+
- ⚠️ Auto IP assignment for `SentryUser` is now guarded by `sendDefaultPii` ([#2726](https://github.com/getsentry/sentry-dart/pull/2726))
62+
- If you rely on Sentry automatically processing the IP address of the user, set `options.sendDefaultPii = true` or manually set the IP address of the `SentryUser` to `{{auto}}`
63+
- Adding the device name to Contexts is now guarded by `sendDefaultPii` ([#2741](https://github.com/getsentry/sentry-dart/pull/2741))
64+
- Set `options.sendDefaultPii = true` if you want to have the device name reported
65+
3866
### Features
3967

4068
- Disable `ScreenshotIntegration`, `WidgetsBindingIntegration` and `SentryWidget` in multi-view apps #2366 ([#2366](https://github.com/getsentry/sentry-dart/pull/2366))
4169

42-
### Fixes
70+
### Enhancements
71+
72+
- Use `loadDebugImagesForAddresses` API for Android ([#2706](https://github.com/getsentry/sentry-dart/pull/2706))
73+
- This reduces the envelope size and data transferred across method channels
74+
- If debug images received by `loadDebugImagesForAddresses` are empty, the SDK loads all debug images as fallback
75+
76+
### Fixes
4377

4478
- Reference to `SentryWidgetsFlutterBinding` in warning message in `FramesTrackingIntegration` ([#2704](https://github.com/getsentry/sentry-dart/pull/2704))
4579

@@ -71,9 +105,43 @@ final db = AppDatabase(executor);
71105
- Bump Native SDK from v0.7.19 to v0.7.20 ([#2652](https://github.com/getsentry/sentry-dart/pull/2652))
72106
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0720)
73107
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.19...0.7.20)
108+
- Bump Cocoa SDK from v8.44.0 to v8.45.0 ([#2718](https://github.com/getsentry/sentry-dart/pull/2718))
109+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8450)
110+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.44.0...8.45.0)
111+
112+
## 8.13.2
113+
114+
> [!WARNING]
115+
> This release contains an issue where Cold starts can be incorrectly reported as Warm starts on Android. We recommend staying on version 8.12.0 if you use this feature on Android.
116+
> See issue [#2769](https://github.com/getsentry/sentry-dart/issues/2769) for more details.
117+
118+
### Fixes
119+
120+
- `build_web_compiler` error ([#2736](https://github.com/getsentry/sentry-dart/pull/2736))
121+
- Use `if (dart.library.html)` instead of `if (dart.html)` for imports
122+
123+
## 8.13.1
124+
125+
> [!WARNING]
126+
> This release contains an issue where Cold starts can be incorrectly reported as Warm starts on Android. We recommend staying on version 8.12.0 if you use this feature on Android.
127+
> See issue [#2769](https://github.com/getsentry/sentry-dart/issues/2769) for more details.
128+
129+
### Fixes
130+
131+
- Replay video interruption if a `navigation` breadcrumb is missing `to` route info ([#2720](https://github.com/getsentry/sentry-dart/pull/2720))
132+
133+
### Dependencies
134+
135+
- Bump Android SDK from v7.20.1 to v7.22.0 ([#2705](https://github.com/getsentry/sentry-dart/pull/2705))
136+
- [changelog](https://github.com/getsentry/sentry-java/blob/7.x.x/CHANGELOG.md#7220)
137+
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...7.22.0)
74138

75139
## 8.13.0
76140

141+
> [!WARNING]
142+
> This release contains an issue where Cold starts can be incorrectly reported as Warm starts on Android. We recommend staying on version 8.12.0 if you use this feature on Android.
143+
> See issue [#2769](https://github.com/getsentry/sentry-dart/issues/2769) for more details.
144+
77145
### Breaking changes
78146

79147
- Remove Metrics API ([#2571](https://github.com/getsentry/sentry-dart/pull/2571))

dart/example_web/web/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Future<void> main() async {
2424
Future<void> runApp() async {
2525
print('runApp');
2626

27+
// ignore: deprecated_member_use
2728
document.querySelector('#output')?.text = 'Your Dart app is running.';
2829

2930
await Sentry.addBreadcrumb(

dart/lib/sentry.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export 'src/integration.dart';
1919
export 'src/noop_isolate_error_integration.dart'
2020
if (dart.library.io) 'src/isolate_error_integration.dart';
2121
export 'src/performance_collector.dart';
22-
export 'src/platform_checker.dart';
22+
export 'src/runtime_checker.dart';
2323
export 'src/protocol.dart';
2424
export 'src/protocol/sentry_feedback.dart';
2525
export 'src/protocol/sentry_proxy.dart';

dart/lib/src/environment/environment_variables.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '../platform_checker.dart';
1+
import '../runtime_checker.dart';
22
import '_io_environment_variables.dart'
33
if (dart.library.js_interop) '_web_environment_variables.dart' as env;
44

@@ -28,7 +28,7 @@ abstract class EnvironmentVariables {
2828

2929
/// Returns an environment based on the compilation mode of Dart or Flutter.
3030
/// This can be set as [SentryOptions.environment]
31-
String environmentForMode(PlatformChecker checker) {
31+
String environmentForMode(RuntimeChecker checker) {
3232
// We infer the environment based on the release/non-release and profile
3333
// constants.
3434

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import '../../protocol/sentry_runtime.dart';
2+
3+
// The Flutter version information can be fetched via Dart defines,
4+
// see
5+
// - https://github.com/flutter/flutter/pull/140783
6+
// - https://github.com/flutter/flutter/pull/163761
7+
//
8+
// This code lives in the Dart only Sentry code, since the code
9+
// doesn't require any Flutter dependency.
10+
// Additionally, this makes it work on background isolates in
11+
// Flutter, where one may not initialize the whole Flutter Sentry
12+
// SDK.
13+
// The const-ness of the properties below ensure that the code
14+
// is tree shaken in a non-Flutter environment.
15+
16+
const _isFlutterRuntimeInformationAbsent = FlutterVersion.version == null ||
17+
FlutterVersion.channel == null ||
18+
FlutterVersion.frameworkRevision == null;
19+
20+
const SentryRuntime? flutterRuntime = _isFlutterRuntimeInformationAbsent
21+
? null
22+
: SentryRuntime(
23+
name: 'Flutter',
24+
version: '${FlutterVersion.version} (${FlutterVersion.channel})',
25+
build: FlutterVersion.frameworkRevision,
26+
rawDescription: '${FlutterVersion.version} (${FlutterVersion.channel}) '
27+
'- Git hash ${FlutterVersion.frameworkRevision} '
28+
'- Git URL ${FlutterVersion.gitUrl}',
29+
);
30+
31+
const SentryRuntime? dartFlutterRuntime = FlutterVersion.dartVersion == null
32+
? null
33+
: SentryRuntime(name: 'Dart', version: FlutterVersion.dartVersion);
34+
35+
/// Details about the Flutter version this app was compiled with,
36+
/// corresponding to the output of `flutter --version`.
37+
///
38+
/// When this Flutter version was build from a fork, or when Flutter runs in a
39+
/// custom embedder, these values might be unreliable.
40+
abstract class FlutterVersion {
41+
const FlutterVersion._();
42+
43+
/// The Flutter version used to compile the app.
44+
static const String? version = bool.hasEnvironment('FLUTTER_VERSION')
45+
? String.fromEnvironment('FLUTTER_VERSION')
46+
: null;
47+
48+
/// The Flutter channel used to compile the app.
49+
static const String? channel = bool.hasEnvironment('FLUTTER_CHANNEL')
50+
? String.fromEnvironment('FLUTTER_CHANNEL')
51+
: null;
52+
53+
/// The URL of the Git repository from which Flutter was obtained.
54+
static const String? gitUrl = bool.hasEnvironment('FLUTTER_GIT_URL')
55+
? String.fromEnvironment('FLUTTER_GIT_URL')
56+
: null;
57+
58+
/// The Flutter framework revision, as a (short) Git commit ID.
59+
static const String? frameworkRevision =
60+
bool.hasEnvironment('FLUTTER_FRAMEWORK_REVISION')
61+
? String.fromEnvironment('FLUTTER_FRAMEWORK_REVISION')
62+
: null;
63+
64+
/// The Flutter engine revision.
65+
static const String? engineRevision =
66+
bool.hasEnvironment('FLUTTER_ENGINE_REVISION')
67+
? String.fromEnvironment('FLUTTER_ENGINE_REVISION')
68+
: null;
69+
70+
// This is included since [Platform.version](https://api.dart.dev/stable/dart-io/Platform/version.html)
71+
// is not included on web platforms.
72+
/// The Dart version used to compile the app.
73+
static const String? dartVersion = bool.hasEnvironment('FLUTTER_DART_VERSION')
74+
? String.fromEnvironment('FLUTTER_DART_VERSION')
75+
: null;
76+
}

dart/lib/src/event_processor/enricher/io_enricher_event_processor.dart

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:meta/meta.dart';
44

55
import '../../../sentry.dart';
66
import 'enricher_event_processor.dart';
7+
import 'flutter_runtime.dart';
78
import 'io_platform_memory.dart';
89

910
EnricherEventProcessor enricherEventProcessor(SentryOptions options) {
@@ -63,12 +64,15 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
6364
version: _dartVersion,
6465
rawDescription: Platform.version,
6566
);
67+
final flRuntime = flutterRuntime;
68+
6669
if (runtimes == null) {
67-
return [dartRuntime];
70+
return [dartRuntime, if (flRuntime != null) flRuntime];
6871
}
6972
return [
7073
...runtimes,
7174
dartRuntime,
75+
if (flRuntime != null) flRuntime,
7276
];
7377
}
7478

@@ -78,25 +82,11 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
7882

7983
String? executable;
8084
if (_options.sendDefaultPii) {
81-
try {
82-
// This throws sometimes for some reason
83-
// https://github.com/flutter/flutter/issues/83921
84-
executable = Platform.executable;
85-
} catch (exception, stackTrace) {
86-
_options.logger(
87-
SentryLevel.error,
88-
'Platform.executable couldn\'t be retrieved.',
89-
exception: exception,
90-
stackTrace: stackTrace,
91-
);
92-
if (_options.automatedTestMode) {
93-
rethrow;
94-
}
95-
}
85+
executable = Platform.executable;
9686
}
9787

9888
return <String, dynamic>{
99-
'compile_mode': _options.platformChecker.compileMode,
89+
'compile_mode': _options.runtimeChecker.compileMode,
10090
if (packageConfig != null) 'package_config': packageConfig,
10191
// The following information could potentially contain PII
10292
if (_options.sendDefaultPii) ...{
@@ -112,7 +102,8 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
112102
SentryDevice _getDevice(SentryDevice? device) {
113103
final platformMemory = PlatformMemory(_options);
114104
return (device ?? SentryDevice()).copyWith(
115-
name: device?.name ?? Platform.localHostname,
105+
name: device?.name ??
106+
(_options.sendDefaultPii ? Platform.localHostname : null),
116107
processorCount: device?.processorCount ?? Platform.numberOfProcessors,
117108
memorySize: device?.memorySize ?? platformMemory.getTotalPhysicalMemory(),
118109
freeMemory: device?.freeMemory ?? platformMemory.getFreePhysicalMemory(),

dart/lib/src/event_processor/enricher/io_platform_memory.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ class PlatformMemory {
1111
final SentryOptions options;
1212

1313
int? getTotalPhysicalMemory() {
14-
if (options.platformChecker.platform.isLinux) {
14+
if (options.platform.isLinux) {
1515
return _getLinuxMemInfoValue('MemTotal');
16-
} else if (options.platformChecker.platform.isWindows) {
16+
} else if (options.platform.isWindows) {
1717
return _getWindowsWmicValue('ComputerSystem', 'TotalPhysicalMemory');
1818
} else {
1919
return null;
2020
}
2121
}
2222

2323
int? getFreePhysicalMemory() {
24-
if (options.platformChecker.platform.isLinux) {
24+
if (options.platform.isLinux) {
2525
return _getLinuxMemInfoValue('MemFree');
26-
} else if (options.platformChecker.platform.isWindows) {
26+
} else if (options.platform.isWindows) {
2727
return _getWindowsWmicValue('OS', 'FreePhysicalMemory');
2828
} else {
2929
return null;

0 commit comments

Comments
 (0)