Skip to content

Commit f2b295c

Browse files
committed
Merge branch 'main' into feat/app-context-screen
2 parents 6ac2ec6 + d189e01 commit f2b295c

37 files changed

+416
-106
lines changed

.github/workflows/flutter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ jobs:
160160
steps:
161161
- uses: actions/checkout@v3
162162
# https://github.com/CocoaPods/CocoaPods/issues/5275#issuecomment-315461879
163-
- run: pod lib lint ios/sentry_flutter.podspec --configuration=Debug --skip-import-validation --allow-warnings
163+
- run: pod lib lint ios/sentry_flutter.podspec --configuration=Debug --skip-import-validation --allow-warnings --verbose
164164

165165
swift-lint:
166166
runs-on: ubuntu-latest

.github/workflows/flutter_integration_test.yml

+20-20
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@ jobs:
1616
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
1717
with:
1818
access_token: ${{ github.token }}
19-
19+
2020
test-android:
2121
runs-on: macos-latest
2222
timeout-minutes: 30
2323
defaults:
24-
run:
25-
working-directory: ./flutter/example
24+
run:
25+
working-directory: ./flutter/example
2626
strategy:
27-
fail-fast: false
28-
matrix:
29-
sdk: ['stable', 'beta']
27+
fail-fast: false
28+
matrix:
29+
sdk: ['stable', 'beta']
3030
steps:
31-
- name: checkout
32-
uses: actions/checkout@v3
31+
- name: checkout
32+
uses: actions/checkout@v3
3333

34-
- uses: actions/setup-java@v3
35-
with:
36-
distribution: 'adopt'
37-
java-version: '11'
34+
- uses: actions/setup-java@v3
35+
with:
36+
distribution: 'adopt'
37+
java-version: '11'
3838

39-
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
40-
with:
41-
channel: ${{ matrix.sdk }}
39+
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
40+
with:
41+
channel: ${{ matrix.sdk }}
4242

43-
- name: flutter upgrade
44-
run: flutter upgrade
43+
- name: flutter upgrade
44+
run: flutter upgrade
4545

46-
- name: flutter pub get
47-
run: flutter pub get
46+
- name: flutter pub get
47+
run: flutter pub get
4848

4949
- name: Gradle cache
5050
uses: gradle/gradle-build-action@v2
@@ -69,7 +69,7 @@ jobs:
6969
disable-animations: false
7070
arch: x86_64
7171
profile: Nexus 6
72-
script: echo "Generated AVD snapshot for caching."
72+
script: echo 'Generated AVD snapshot for caching.'
7373

7474
- name: launch android emulator & run android integration test
7575
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #[email protected]

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

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
workingDir: flutter/example
2121
customArgs: --source-maps
2222
webRenderer: canvaskit
23+
baseHref: "/sentry-dart/"
2324

2425
- name: Upload source maps
2526
run: |

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,33 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- Fixing memory leak issue in SentryFlutterPlugin (Android Plugin) ([#1588](https://github.com/getsentry/sentry-dart/pull/1588))
8+
9+
### Dependencies
10+
11+
- Bump Android SDK from v6.25.2 to v6.28.0 ([#1586](https://github.com/getsentry/sentry-dart/pull/1586))
12+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6280)
13+
- [diff](https://github.com/getsentry/sentry-java/compare/6.25.2...6.28.0)
14+
- Bump Cocoa SDK from v8.9.1 to v8.10.0 ([#1584](https://github.com/getsentry/sentry-dart/pull/1584), [#1606](https://github.com/getsentry/sentry-dart/pull/1606))
15+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8100)
16+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.9.1...8.10.0)
17+
18+
## 7.9.0
19+
520
### Features
621

722
- Add `SentryNavigatorObserver` current route to `event.app.contexts.viewNames` ([#1545](https://github.com/getsentry/sentry-dart/pull/1545))
823
- Send trace origin ([#1534](https://github.com/getsentry/sentry-dart/pull/1534))
924

1025
[Trace origin](https://develop.sentry.dev/sdk/performance/trace-origin/) indicates what created a trace or a span. Not all transactions and spans contain enough information to tell whether the user or what precisely in the SDK created it. Origin solves this problem. The SDK now sends origin for transactions and spans.
1126

27+
- Add `appHangTimeoutInterval` to `SentryFlutterOptions` ([#1568](https://github.com/getsentry/sentry-dart/pull/1568))
28+
- DioEventProcessor: Append http response body ([#1557](https://github.com/getsentry/sentry-dart/pull/1557))
29+
- This is opt-in and depends on `maxResponseBodySize`
30+
- Only for `dio` package
31+
1232
### Dependencies
1333

1434
- Bump Cocoa SDK from v8.8.0 to v8.9.1 ([#1553](https://github.com/getsentry/sentry-dart/pull/1553))

dart/lib/sentry.dart

+2
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ export 'src/utils/url_details.dart';
4646
export 'src/utils/http_header_utils.dart';
4747
// ignore: invalid_export_of_internal_element
4848
export 'src/sentry_trace_origins.dart';
49+
// ignore: invalid_export_of_internal_element
50+
export 'src/utils.dart';

dart/lib/src/sentry_options.dart

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import 'diagnostic_logger.dart';
1313
import 'environment/environment_variables.dart';
1414
import 'noop_client.dart';
1515
import 'transport/noop_transport.dart';
16-
import 'utils.dart';
1716
import 'version.dart';
1817

1918
// TODO: shutdownTimeout, flushTimeoutMillis

dart/lib/src/utils.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import 'package:meta/meta.dart';
88

99
/// Sentry does not take a timezone and instead expects the date-time to be
1010
/// submitted in UTC timezone.
11+
@internal
1112
DateTime getUtcDateTime() => DateTime.now().toUtc();
1213

1314
/// Formats a Date as ISO8601 and UTC with millis precision
15+
@internal
1416
String formatDateAsIso8601WithMillisPrecision(DateTime date) {
1517
var iso = date.toIso8601String();
1618
final millisecondSeparatorIndex = iso.lastIndexOf('.');
@@ -22,9 +24,10 @@ String formatDateAsIso8601WithMillisPrecision(DateTime date) {
2224
return '${iso}Z';
2325
}
2426

27+
@internal
2528
final utf8JsonEncoder = JsonUtf8Encoder(null, jsonSerializationFallback, null);
2629

27-
@visibleForTesting
30+
@internal
2831
Object? jsonSerializationFallback(Object? nonEncodable) {
2932
if (nonEncodable == null) {
3033
return null;

dart/lib/src/version.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
library version;
1010

1111
/// The SDK version reported to Sentry.io in the submitted events.
12-
const String sdkVersion = '7.8.0';
12+
const String sdkVersion = '7.9.0';
1313

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

dart/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sentry
2-
version: 7.8.0
2+
version: 7.9.0
33
description: >
44
A crash reporting library for Dart that sends crash reports to Sentry.io.
55
This library supports Dart VM and Web. For Flutter consider sentry_flutter instead.

dart/test/protocol/breadcrumb_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:collection/collection.dart';
22
import 'package:sentry/sentry.dart';
33
import 'package:test/test.dart';
4-
import 'package:sentry/src/utils.dart';
54

65
void main() {
76
final timestamp = DateTime.now();

dart/test/sentry_envelope_header_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:sentry/sentry.dart';
22
import 'package:sentry/src/sentry_envelope_header.dart';
3-
import 'package:sentry/src/utils.dart';
43
import 'package:test/test.dart';
54

65
import 'mocks.dart';

dart/test/sentry_envelope_item_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:sentry/src/sentry_envelope_item_header.dart';
88
import 'package:sentry/src/sentry_item_type.dart';
99
import 'package:sentry/src/sentry_tracer.dart';
1010
import 'package:sentry/src/transport/data_category.dart';
11-
import 'package:sentry/src/utils.dart';
1211
import 'package:test/test.dart';
1312

1413
import 'mocks/mock_hub.dart';

dart/test/sentry_envelope_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:sentry/src/sentry_envelope_header.dart';
66
import 'package:sentry/src/sentry_envelope_item_header.dart';
77
import 'package:sentry/src/sentry_item_type.dart';
88
import 'package:sentry/src/sentry_tracer.dart';
9-
import 'package:sentry/src/utils.dart';
109
import 'package:test/test.dart';
1110

1211
import 'mocks.dart';

dart/test/sentry_event_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import 'package:collection/collection.dart';
66
import 'package:sentry/sentry.dart';
77
import 'package:sentry/src/version.dart';
8-
import 'package:sentry/src/utils.dart';
98
import 'package:test/test.dart';
109

1110
void main() {

dart/test/sentry_span_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:sentry/sentry.dart';
22
import 'package:sentry/src/sentry_tracer.dart';
3-
import 'package:sentry/src/utils.dart';
43
import 'package:test/test.dart';
54

65
import 'mocks/mock_hub.dart';

dart/test/sentry_tracer_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:sentry/sentry.dart';
22
import 'package:sentry/src/sentry_tracer.dart';
3-
import 'package:sentry/src/utils.dart';
43
import 'package:test/test.dart';
54

65
import 'mocks.dart';

dio/lib/src/dio_event_processor.dart

+70-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// ignore_for_file: deprecated_member_use
22

3+
import 'dart:convert';
4+
35
import 'package:dio/dio.dart';
46
import 'package:sentry/sentry.dart';
57

@@ -62,7 +64,7 @@ class DioEventProcessor implements EventProcessor {
6264
}
6365

6466
/// Returns the request data, if possible according to the users settings.
65-
Object? _getRequestData(dynamic data) {
67+
Object? _getRequestData(Object? data) {
6668
if (!_options.sendDefaultPii) {
6769
return null;
6870
}
@@ -87,8 +89,74 @@ class DioEventProcessor implements EventProcessor {
8789

8890
return SentryResponse(
8991
headers: _options.sendDefaultPii ? headers : null,
90-
bodySize: dioError.response?.data?.length as int?,
92+
bodySize: _getBodySize(
93+
dioError.response?.data,
94+
dioError.requestOptions.responseType,
95+
),
9196
statusCode: response?.statusCode,
97+
data: _getResponseData(
98+
dioError.response?.data,
99+
dioError.requestOptions.responseType,
100+
),
92101
);
93102
}
103+
104+
/// Returns the response data, if possible according to the users settings.
105+
Object? _getResponseData(Object? data, ResponseType responseType) {
106+
if (!_options.sendDefaultPii || data == null) {
107+
return null;
108+
}
109+
switch (responseType) {
110+
case ResponseType.json:
111+
// ignore: invalid_use_of_internal_member
112+
final jsData = utf8JsonEncoder.convert(data);
113+
if (_options.maxResponseBodySize.shouldAddBody(jsData.length)) {
114+
return data;
115+
}
116+
break;
117+
case ResponseType.stream:
118+
break; // No support for logging stream body.
119+
case ResponseType.plain:
120+
if (data is String &&
121+
_options.maxResponseBodySize.shouldAddBody(data.codeUnits.length)) {
122+
return data;
123+
}
124+
break;
125+
case ResponseType.bytes:
126+
if (data is List<int> &&
127+
_options.maxResponseBodySize.shouldAddBody(data.length)) {
128+
return data;
129+
}
130+
break;
131+
}
132+
return null;
133+
}
134+
135+
int? _getBodySize(Object? data, ResponseType responseType) {
136+
if (data == null) {
137+
return null;
138+
}
139+
switch (responseType) {
140+
case ResponseType.json:
141+
return json.encode(data).codeUnits.length;
142+
case ResponseType.stream:
143+
if (data is String) {
144+
return data.length;
145+
} else {
146+
return null;
147+
}
148+
case ResponseType.plain:
149+
if (data is String) {
150+
return data.codeUnits.length;
151+
} else {
152+
return null;
153+
}
154+
case ResponseType.bytes:
155+
if (data is List<int>) {
156+
return data.length;
157+
} else {
158+
return null;
159+
}
160+
}
161+
}
94162
}

dio/lib/src/version.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// The SDK version reported to Sentry.io in the submitted events.
2-
const String sdkVersion = '7.8.0';
2+
const String sdkVersion = '7.9.0';
33

44
/// The package name reported to Sentry.io in the submitted events.
55
const String packageName = 'pub:sentry_dio';

dio/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sentry_dio
22
description: An integration which adds support for performance tracing for the Dio package.
3-
version: 7.8.0
3+
version: 7.9.0
44
homepage: https://docs.sentry.io/platforms/dart/
55
repository: https://github.com/getsentry/sentry-dart
66
issue_tracker: https://github.com/getsentry/sentry-dart/issues
@@ -11,7 +11,7 @@ environment:
1111

1212
dependencies:
1313
dio: ^5.0.0
14-
sentry: 7.8.0
14+
sentry: 7.9.0
1515

1616
dev_dependencies:
1717
meta: ^1.3.0

0 commit comments

Comments
 (0)