Skip to content

Commit

Permalink
Merge branch 'main' into feat/capture-http-response-body-for-sentry-h…
Browse files Browse the repository at this point in the history
…ttp-client
  • Loading branch information
martinhaintz authored Nov 25, 2024
2 parents a188061 + 4c13d97 commit 4d43edd
Show file tree
Hide file tree
Showing 80 changed files with 1,145 additions and 804 deletions.
10 changes: 7 additions & 3 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ body:
id: environment
attributes:
label: Platform
description: Which platform do you use?
description: Which platforms does this bug affect?
multiple: true
options:
- Dart
- Dart Web
- Flutter Mobile
- Flutter Desktop
- Flutter Mobile iOS
- Flutter Mobile Android
- Flutter Desktop Windows
- Flutter Desktop Linux
- Flutter Web
- Flutter Wasm
validations:
required: true

Expand Down
3 changes: 2 additions & 1 deletion .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ high_risk_code: &high_risk_code
- "flutter/lib/src/integrations/native_app_start_integration.dart"
- "flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt"
- "flutter/ios/Classes/SentryFlutterPluginApple.swift"

- "flutter/lib/src/screenshot/recorder.dart"
- "flutter/lib/src/screenshot/widget_filter.dart"
2 changes: 1 addition & 1 deletion .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: 'Setup Linux'
run: |
sudo apt update
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb libcurl4-openssl-dev
sudo apt install -y network-manager upower
if: matrix.target == 'linux'

Expand Down
71 changes: 54 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased

### Enhancements
### Features

- Make response body accessible via hint in `beforSend` callback for failed web requests or if tracing is enabled in `SentryHttpClient` ([#2293](https://github.com/getsentry/sentry-dart/pull/2293))
```dart
Expand All @@ -15,16 +15,43 @@
return event;
};
```
- Only send debug images referenced in the stacktrace for events ([#2329](https://github.com/getsentry/sentry-dart/pull/2329))
- Remove `sentry` frames if SDK falls back to current stack trace ([#2351](https://github.com/getsentry/sentry-dart/pull/2351))
- Flutter doesn't always provide stack traces for unhandled errors - this is normal Flutter behavior
- When no stack trace is provided (in Flutter errors, `captureException`, or `captureMessage`):
- SDK creates a synthetic trace using `StackTrace.current`
- Internal SDK frames are removed to reduce noise
- Original stack traces (when provided) are left unchanged

- Support for screenshot PII content masking ([#2361](https://github.com/getsentry/sentry-dart/pull/2361))
By default, masking is enabled for SessionReplay. To also enable it for screenshots captured with events, you can specify `options.experimental.privacy`:
```dart
await SentryFlutter.init(
(options) {
...
// the defaults are:
options.experimental.privacy.maskAllText = true;
options.experimental.privacy.maskAllImages = true;
options.experimental.privacy.maskAssetImages = false;
// you cal also set up custom masking, for example:
options.experimental.privacy.mask<WebView>();
},
appRunner: () => runApp(MyApp()),
);
```
Actually, just accessing this field will cause it to be initialized with the default settings to mask all text and images:
```dart
await SentryFlutter.init(
(options) {
...
// this has a side-effect of creating the default privacy configuration, thus enabling Screenshot masking:
options.experimental.privacy;
},
appRunner: () => runApp(MyApp()),
);
```
- Linux native error & obfuscation support ([#2431](https://github.com/getsentry/sentry-dart/pull/2431))
- Improve Device context on plain Dart and Flutter desktop apps ([#2441](https://github.com/getsentry/sentry-dart/pull/2441))

## 8.11.0-beta.1

### Features

- Windows native error & obfuscation support ([#2286](https://github.com/getsentry/sentry-dart/pull/2286), [#2426](https://github.com/getsentry/sentry-dart/pull/2426))
- Improve app start measurements by using `addTimingsCallback` instead of `addPostFrameCallback` to determine app start end ([#2405](https://github.com/getsentry/sentry-dart/pull/2405))
- ⚠️ This change may result in reporting of shorter app start durations
- Improve frame tracking accuracy ([#2372](https://github.com/getsentry/sentry-dart/pull/2372))
- Introduces `SentryWidgetsFlutterBinding` that tracks a frame starting from `handleBeginFrame` and ending in `handleDrawFrame`, this is approximately the [buildDuration](https://api.flutter.dev/flutter/dart-ui/FrameTiming/buildDuration.html) time
- By default, `SentryFlutter.init()` automatically initializes `SentryWidgetsFlutterBinding` through the `WidgetsFlutterBindingIntegration`
Expand All @@ -33,13 +60,23 @@
void main() async {
// Replace WidgetsFlutterBinding.ensureInitialized()
SentryWidgetsFlutterBinding.ensureInitialized();
await SentryFlutter.init(...);
runApp(MyApp());
}
```
- ⚠️ Frame tracking will be disabled if a different binding is used

### Enhancements

- Only send debug images referenced in the stacktrace for events ([#2329](https://github.com/getsentry/sentry-dart/pull/2329))
- Remove `sentry` frames if SDK falls back to current stack trace ([#2351](https://github.com/getsentry/sentry-dart/pull/2351))
- Flutter doesn't always provide stack traces for unhandled errors - this is normal Flutter behavior
- When no stack trace is provided (in Flutter errors, `captureException`, or `captureMessage`):
- SDK creates a synthetic trace using `StackTrace.current`
- Internal SDK frames are removed to reduce noise
- Original stack traces (when provided) are left unchanged

### Fixes

- Apply default IP address (`{{auto}}`) to transactions ([#2395](https://github.com/getsentry/sentry-dart/pull/2395))
Expand All @@ -53,9 +90,9 @@
- Bump Android SDK from v7.16.0 to v7.18.0 ([#2408](https://github.com/getsentry/sentry-dart/pull/2408), [#2419](https://github.com/getsentry/sentry-dart/pull/2419))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7180)
- [diff](https://github.com/getsentry/sentry-java/compare/7.16.0...7.18.0)
- Bump Native SDK from v0.7.12 to v0.7.13 ([#2420](https://github.com/getsentry/sentry-dart/pull/2420))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0713)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.12...0.7.13)
- Bump Native SDK from v0.7.12 to v0.7.15 ([#2430](https://github.com/getsentry/sentry-dart/pull/2430))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0715)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.12...0.7.15)

## 8.10.1

Expand Down Expand Up @@ -110,15 +147,15 @@
),
);
```

- Add screenshot to `SentryFeedbackWidget` ([#2369](https://github.com/getsentry/sentry-dart/pull/2369))
- Use `SentryFlutter.captureScreenshot` to create a screenshot attachment
- Call `SentryFeedbackWidget` with this attachment to add it to the user feedback

```dart
final id = await Sentry.captureMessage('UserFeedback');
final screenshot = await SentryFlutter.captureScreenshot();
Navigator.push(
context,
MaterialPageRoute(
Expand All @@ -136,7 +173,7 @@
- Avoid sending too many empty client reports when Http Transport is used ([#2380](https://github.com/getsentry/sentry-dart/pull/2380))
- Cache parsed DSN ([#2365](https://github.com/getsentry/sentry-dart/pull/2365))
- Handle backpressure earlier in pipeline ([#2371](https://github.com/getsentry/sentry-dart/pull/2371))
- Drops max un-awaited parallel tasks earlier, so event processors & callbacks are not executed for them.
- Drops max un-awaited parallel tasks earlier, so event processors & callbacks are not executed for them.
- Change by setting `SentryOptions.maxQueueSize`. Default is 30.
- Use native spotlight integrations on Flutter Android, iOS, macOS ([#2285](https://github.com/getsentry/sentry-dart/pull/2285))
- Improve app start integration ([#2266](https://github.com/getsentry/sentry-dart/pull/2266))
Expand All @@ -163,7 +200,7 @@

- Metrics API ([#2312](https://github.com/getsentry/sentry-dart/pull/2312))
- Learn more: https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Metrics-Beta-Coming-to-an-End

### Dependencies

- Bump Native SDK from v0.7.10 to v0.7.12 ([#2390](https://github.com/getsentry/sentry-dart/pull/2390))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:io';

import 'package:meta/meta.dart';

import '../../../sentry.dart';
import 'enricher_event_processor.dart';
import 'io_platform_memory.dart';
Expand All @@ -16,6 +18,8 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {

final SentryOptions _options;
late final String _dartVersion = _extractDartVersion(Platform.version);
late final SentryOperatingSystem _os = extractOperatingSystem(
Platform.operatingSystem, Platform.operatingSystemVersion);

/// Extracts the semantic version and channel from the full version string.
///
Expand Down Expand Up @@ -137,9 +141,46 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
}

SentryOperatingSystem _getOperatingSystem(SentryOperatingSystem? os) {
return (os ?? SentryOperatingSystem()).copyWith(
name: os?.name ?? Platform.operatingSystem,
version: os?.version ?? Platform.operatingSystemVersion,
if (os == null) {
return _os.clone();
} else {
return _os.mergeWith(os);
}
}

@internal
SentryOperatingSystem extractOperatingSystem(
String name, String rawDescription) {
RegExpMatch? match;
switch (name) {
case 'android':
match = _androidOsRegexp.firstMatch(rawDescription);
name = 'Android';
break;
case 'ios':
name = 'iOS';
match = _appleOsRegexp.firstMatch(rawDescription);
break;
case 'macos':
name = 'macOS';
match = _appleOsRegexp.firstMatch(rawDescription);
break;
case 'linux':
name = 'Linux';
match = _linuxOsRegexp.firstMatch(rawDescription);
break;
case 'windows':
name = 'Windows';
match = _windowsOsRegexp.firstMatch(rawDescription);
break;
}

return SentryOperatingSystem(
name: name,
rawDescription: rawDescription,
version: match?.namedGroupOrNull('version'),
build: match?.namedGroupOrNull('build'),
kernelVersion: match?.namedGroupOrNull('kernelVersion'),
);
}

Expand All @@ -150,3 +191,32 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
);
}
}

// LYA-L29 10.1.0.289(C432E7R1P5)
// TE1A.220922.010
final _androidOsRegexp = RegExp('^(?<build>.*)\$', caseSensitive: false);

// Linux 5.11.0-1018-gcp #20~20.04.2-Ubuntu SMP Fri Sep 3 01:01:37 UTC 2021
final _linuxOsRegexp = RegExp(
'(?<kernelVersion>[a-z0-9+.\\-]+) (?<build>#.*)\$',
caseSensitive: false);

// Version 14.5 (Build 18E182)
final _appleOsRegexp = RegExp(
'(?<version>[a-z0-9+.\\-]+)( \\(Build (?<build>[a-z0-9+.\\-]+))\\)?\$',
caseSensitive: false);

// "Windows 10 Pro" 10.0 (Build 19043)
final _windowsOsRegexp = RegExp(
' (?<version>[a-z0-9+.\\-]+)( \\(Build (?<build>[a-z0-9+.\\-]+))\\)?\$',
caseSensitive: false);

extension on RegExpMatch {
String? namedGroupOrNull(String name) {
if (groupNames.contains(name)) {
return namedGroup(name);
} else {
return null;
}
}
}
8 changes: 5 additions & 3 deletions dart/lib/src/platform_checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ class PlatformChecker {
// the OS checks return true when the browser runs on the checked platform.
// Example: platform.isAndroid return true if the browser is used on an
// Android device.
return platform.isAndroid || platform.isIOS || platform.isMacOS;
// Temporarily disabled due to https://github.com/getsentry/sentry-dart-plugin/issues/270
// platform.isWindows
return platform.isAndroid ||
platform.isIOS ||
platform.isMacOS ||
platform.isWindows ||
platform.isLinux;
}

static bool _isWebWithWasmSupport() {
Expand Down
16 changes: 16 additions & 0 deletions dart/lib/src/protocol/sentry_operating_system.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,20 @@ class SentryOperatingSystem {
theme: theme ?? this.theme,
unknown: unknown,
);

SentryOperatingSystem mergeWith(SentryOperatingSystem other) =>
SentryOperatingSystem(
name: other.name ?? name,
version: other.version ?? version,
build: other.build ?? build,
kernelVersion: other.kernelVersion ?? kernelVersion,
rooted: other.rooted ?? rooted,
rawDescription: other.rawDescription ?? rawDescription,
theme: other.theme ?? theme,
unknown: other.unknown == null
? unknown
: unknown == null
? null
: {...unknown!, ...other.unknown!},
);
}
2 changes: 1 addition & 1 deletion dart/lib/src/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
library version;

/// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '8.10.1';
const String sdkVersion = '8.11.0-beta.1';

String sdkName(bool isWeb) => isWeb ? _browserSdkName : _ioSdkName;

Expand Down
2 changes: 1 addition & 1 deletion dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sentry
version: 8.10.1
version: 8.11.0-beta.1
description: >
A crash reporting library for Dart that sends crash reports to Sentry.io.
This library supports Dart VM and Web. For Flutter consider sentry_flutter instead.
Expand Down
Loading

0 comments on commit 4d43edd

Please sign in to comment.