Skip to content

Commit

Permalink
Merge branch 'main' into feat/app-context-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Aug 22, 2023
2 parents 6ac2ec6 + d189e01 commit f2b295c
Show file tree
Hide file tree
Showing 37 changed files with 416 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ jobs:
steps:
- uses: actions/checkout@v3
# https://github.com/CocoaPods/CocoaPods/issues/5275#issuecomment-315461879
- run: pod lib lint ios/sentry_flutter.podspec --configuration=Debug --skip-import-validation --allow-warnings
- run: pod lib lint ios/sentry_flutter.podspec --configuration=Debug --skip-import-validation --allow-warnings --verbose

swift-lint:
runs-on: ubuntu-latest
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/flutter_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ jobs:
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # pin@0.11.0
with:
access_token: ${{ github.token }}

test-android:
runs-on: macos-latest
timeout-minutes: 30
defaults:
run:
working-directory: ./flutter/example
run:
working-directory: ./flutter/example
strategy:
fail-fast: false
matrix:
sdk: ['stable', 'beta']
fail-fast: false
matrix:
sdk: ['stable', 'beta']
steps:
- name: checkout
uses: actions/checkout@v3
- name: checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'

- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0
with:
channel: ${{ matrix.sdk }}
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0
with:
channel: ${{ matrix.sdk }}

- name: flutter upgrade
run: flutter upgrade
- name: flutter upgrade
run: flutter upgrade

- name: flutter pub get
run: flutter pub get
- name: flutter pub get
run: flutter pub get

- name: Gradle cache
uses: gradle/gradle-build-action@v2
Expand All @@ -69,7 +69,7 @@ jobs:
disable-animations: false
arch: x86_64
profile: Nexus 6
script: echo "Generated AVD snapshot for caching."
script: echo 'Generated AVD snapshot for caching.'

- name: launch android emulator & run android integration test
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #pin@v2.28.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/web-example-ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
workingDir: flutter/example
customArgs: --source-maps
webRenderer: canvaskit
baseHref: "/sentry-dart/"

- name: Upload source maps
run: |
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,33 @@

## Unreleased

### Fixes

- Fixing memory leak issue in SentryFlutterPlugin (Android Plugin) ([#1588](https://github.com/getsentry/sentry-dart/pull/1588))

### Dependencies

- Bump Android SDK from v6.25.2 to v6.28.0 ([#1586](https://github.com/getsentry/sentry-dart/pull/1586))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6280)
- [diff](https://github.com/getsentry/sentry-java/compare/6.25.2...6.28.0)
- 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))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8100)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.9.1...8.10.0)

## 7.9.0

### Features

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

[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.

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

### Dependencies

- Bump Cocoa SDK from v8.8.0 to v8.9.1 ([#1553](https://github.com/getsentry/sentry-dart/pull/1553))
Expand Down
2 changes: 2 additions & 0 deletions dart/lib/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ export 'src/utils/url_details.dart';
export 'src/utils/http_header_utils.dart';
// ignore: invalid_export_of_internal_element
export 'src/sentry_trace_origins.dart';
// ignore: invalid_export_of_internal_element
export 'src/utils.dart';
1 change: 0 additions & 1 deletion dart/lib/src/sentry_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'diagnostic_logger.dart';
import 'environment/environment_variables.dart';
import 'noop_client.dart';
import 'transport/noop_transport.dart';
import 'utils.dart';
import 'version.dart';

// TODO: shutdownTimeout, flushTimeoutMillis
Expand Down
5 changes: 4 additions & 1 deletion dart/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import 'package:meta/meta.dart';

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

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

@internal
final utf8JsonEncoder = JsonUtf8Encoder(null, jsonSerializationFallback, null);

@visibleForTesting
@internal
Object? jsonSerializationFallback(Object? nonEncodable) {
if (nonEncodable == null) {
return null;
Expand Down
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 = '7.8.0';
const String sdkVersion = '7.9.0';

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: 7.8.0
version: 7.9.0
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
1 change: 0 additions & 1 deletion dart/test/protocol/breadcrumb_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:collection/collection.dart';
import 'package:sentry/sentry.dart';
import 'package:test/test.dart';
import 'package:sentry/src/utils.dart';

void main() {
final timestamp = DateTime.now();
Expand Down
1 change: 0 additions & 1 deletion dart/test/sentry_envelope_header_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:sentry/sentry.dart';
import 'package:sentry/src/sentry_envelope_header.dart';
import 'package:sentry/src/utils.dart';
import 'package:test/test.dart';

import 'mocks.dart';
Expand Down
1 change: 0 additions & 1 deletion dart/test/sentry_envelope_item_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:sentry/src/sentry_envelope_item_header.dart';
import 'package:sentry/src/sentry_item_type.dart';
import 'package:sentry/src/sentry_tracer.dart';
import 'package:sentry/src/transport/data_category.dart';
import 'package:sentry/src/utils.dart';
import 'package:test/test.dart';

import 'mocks/mock_hub.dart';
Expand Down
1 change: 0 additions & 1 deletion dart/test/sentry_envelope_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:sentry/src/sentry_envelope_header.dart';
import 'package:sentry/src/sentry_envelope_item_header.dart';
import 'package:sentry/src/sentry_item_type.dart';
import 'package:sentry/src/sentry_tracer.dart';
import 'package:sentry/src/utils.dart';
import 'package:test/test.dart';

import 'mocks.dart';
Expand Down
1 change: 0 additions & 1 deletion dart/test/sentry_event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import 'package:collection/collection.dart';
import 'package:sentry/sentry.dart';
import 'package:sentry/src/version.dart';
import 'package:sentry/src/utils.dart';
import 'package:test/test.dart';

void main() {
Expand Down
1 change: 0 additions & 1 deletion dart/test/sentry_span_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:sentry/sentry.dart';
import 'package:sentry/src/sentry_tracer.dart';
import 'package:sentry/src/utils.dart';
import 'package:test/test.dart';

import 'mocks/mock_hub.dart';
Expand Down
1 change: 0 additions & 1 deletion dart/test/sentry_tracer_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:sentry/sentry.dart';
import 'package:sentry/src/sentry_tracer.dart';
import 'package:sentry/src/utils.dart';
import 'package:test/test.dart';

import 'mocks.dart';
Expand Down
72 changes: 70 additions & 2 deletions dio/lib/src/dio_event_processor.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// ignore_for_file: deprecated_member_use

import 'dart:convert';

import 'package:dio/dio.dart';
import 'package:sentry/sentry.dart';

Expand Down Expand Up @@ -62,7 +64,7 @@ class DioEventProcessor implements EventProcessor {
}

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

return SentryResponse(
headers: _options.sendDefaultPii ? headers : null,
bodySize: dioError.response?.data?.length as int?,
bodySize: _getBodySize(
dioError.response?.data,
dioError.requestOptions.responseType,
),
statusCode: response?.statusCode,
data: _getResponseData(
dioError.response?.data,
dioError.requestOptions.responseType,
),
);
}

/// Returns the response data, if possible according to the users settings.
Object? _getResponseData(Object? data, ResponseType responseType) {
if (!_options.sendDefaultPii || data == null) {
return null;
}
switch (responseType) {
case ResponseType.json:
// ignore: invalid_use_of_internal_member
final jsData = utf8JsonEncoder.convert(data);
if (_options.maxResponseBodySize.shouldAddBody(jsData.length)) {
return data;
}
break;
case ResponseType.stream:
break; // No support for logging stream body.
case ResponseType.plain:
if (data is String &&
_options.maxResponseBodySize.shouldAddBody(data.codeUnits.length)) {
return data;
}
break;
case ResponseType.bytes:
if (data is List<int> &&
_options.maxResponseBodySize.shouldAddBody(data.length)) {
return data;
}
break;
}
return null;
}

int? _getBodySize(Object? data, ResponseType responseType) {
if (data == null) {
return null;
}
switch (responseType) {
case ResponseType.json:
return json.encode(data).codeUnits.length;
case ResponseType.stream:
if (data is String) {
return data.length;
} else {
return null;
}
case ResponseType.plain:
if (data is String) {
return data.codeUnits.length;
} else {
return null;
}
case ResponseType.bytes:
if (data is List<int>) {
return data.length;
} else {
return null;
}
}
}
}
2 changes: 1 addition & 1 deletion dio/lib/src/version.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '7.8.0';
const String sdkVersion = '7.9.0';

/// The package name reported to Sentry.io in the submitted events.
const String packageName = 'pub:sentry_dio';
4 changes: 2 additions & 2 deletions dio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sentry_dio
description: An integration which adds support for performance tracing for the Dio package.
version: 7.8.0
version: 7.9.0
homepage: https://docs.sentry.io/platforms/dart/
repository: https://github.com/getsentry/sentry-dart
issue_tracker: https://github.com/getsentry/sentry-dart/issues
Expand All @@ -11,7 +11,7 @@ environment:

dependencies:
dio: ^5.0.0
sentry: 7.8.0
sentry: 7.9.0

dev_dependencies:
meta: ^1.3.0
Expand Down
Loading

0 comments on commit f2b295c

Please sign in to comment.