Skip to content

Commit 5e59d38

Browse files
committed
fix conflict
2 parents 640ade3 + aed5947 commit 5e59d38

File tree

57 files changed

+851
-212
lines changed

Some content is hidden

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

57 files changed

+851
-212
lines changed

.github/workflows/analyze.yml

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
access_token: ${{ github.token }}
2525

2626
analyze:
27+
# `invertase/github-action-dart-analyzer` is using `flutter pub upgrade` instead of `get`,
28+
# which ignores pubspec.yaml `dependency_overrides`. Because of that, all `release/*` branches are failing,
29+
# because the package cannot find the "about to be released" version of our sentry-dart package that it depends on.
30+
if: ${{ !startsWith(github.ref, 'refs/heads/release/') && inputs.panaThreshold > 0 }}
2731
runs-on: ubuntu-latest
2832
timeout-minutes: 20
2933
defaults:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: flutter integration tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
cancel-previous-workflow:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Cancel Previous Runs
13+
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
14+
with:
15+
access_token: ${{ github.token }}
16+
17+
test-android:
18+
runs-on: macos-latest
19+
defaults:
20+
run:
21+
working-directory: ./flutter/example
22+
strategy:
23+
matrix:
24+
sdk: ['stable', 'beta']
25+
steps:
26+
- name: checkout
27+
uses: actions/checkout@v3
28+
29+
- uses: actions/setup-java@v3
30+
with:
31+
distribution: 'adopt'
32+
java-version: '8'
33+
34+
- uses: subosito/flutter-action@1e6ee87cb840500837bcd50a667fb28815d8e310 # pin@v2
35+
with:
36+
channel: ${{ matrix.sdk }}
37+
38+
- name: flutter upgrade
39+
run: flutter upgrade
40+
41+
- name: flutter pub get
42+
run: flutter pub get
43+
44+
- name: launch android emulator & run android integration test
45+
uses: reactivecircus/android-emulator-runner@d7b53ddc6e44254e1f4cf4a6ad67345837027a66 #[email protected]
46+
with:
47+
working-directory: ./flutter/example
48+
api-level: 21
49+
arch: x86_64
50+
profile: Nexus 6
51+
script: flutter test integration_test/integration_test.dart
52+
test-ios:
53+
runs-on: macos-11
54+
defaults:
55+
run:
56+
working-directory: ./flutter/example
57+
strategy:
58+
matrix:
59+
sdk: ['stable', 'beta']
60+
steps:
61+
- name: checkout
62+
uses: actions/checkout@v3
63+
64+
- uses: subosito/flutter-action@1e6ee87cb840500837bcd50a667fb28815d8e310 # pin@v2
65+
with:
66+
channel: ${{ matrix.sdk }}
67+
68+
- name: flutter upgrade
69+
run: flutter upgrade
70+
71+
- name: flutter pub get
72+
run: flutter pub get
73+
74+
- name: launch ios emulator
75+
uses: futureware-tech/simulator-action@ee05c113b79f056b47f354d7b313555f5491e158 #pin@v2
76+
with:
77+
model: 'iPhone 8'
78+
os_version: '15.2'
79+
80+
- name: run ios integration test
81+
run: flutter test integration_test/integration_test.dart

CHANGELOG.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,41 @@
11
# Changelog
22

3-
## Unreleased
3+
## 6.16.1
44

55
### Fixes
66

7+
- Do not attach headers if Span is NoOp ([#1143](https://github.com/getsentry/sentry-dart/pull/1143))
8+
9+
### Dependencies
10+
11+
- Bump Cocoa SDK from v7.31.1 to v7.31.2 ([#1146](https://github.com/getsentry/sentry-dart/pull/1146))
12+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7312)
13+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.31.1...7.31.2)
14+
- Bump Android SDK from v6.7.1 to v6.8.0 ([#1147](https://github.com/getsentry/sentry-dart/pull/1147))
15+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#680)
16+
- [diff](https://github.com/getsentry/sentry-java/compare/6.7.1...6.8.0)
17+
18+
## 6.16.0
19+
20+
### Features
21+
22+
- Add request context to `HttpException`, `SocketException` and `NetworkImageLoadException` ([#1118](https://github.com/getsentry/sentry-dart/pull/1118))
23+
- `SocketException` and `FileSystemException` with `OSError`s report the `OSError` as root exception ([#1118](https://github.com/getsentry/sentry-dart/pull/1118))
24+
25+
### Fixes
26+
27+
- VendorId should be a String ([#1112](https://github.com/getsentry/sentry-dart/pull/1112))
728
- Disable `enableUserInteractionBreadcrumbs` on Android when `enableAutoNativeBreadcrumbs` is disabled ([#1131](https://github.com/getsentry/sentry-dart/pull/1131))
29+
- Transaction name is reset after the transaction finishes ([#1125](https://github.com/getsentry/sentry-dart/pull/1125))
30+
31+
### Dependencies
32+
33+
- Bump Cocoa SDK from v7.30.2 to v7.31.1 ([#1132](https://github.com/getsentry/sentry-dart/pull/1132), [#1139](https://github.com/getsentry/sentry-dart/pull/1139))
34+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7311)
35+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.30.2...7.31.1)
36+
- Bump Android SDK from v6.7.0 to v6.7.1 ([#1112](https://github.com/getsentry/sentry-dart/pull/1112))
37+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#671)
38+
- [diff](https://github.com/getsentry/sentry-java/compare/6.7.0...6.7.1)
839

940
## 6.15.1
1041

dart/lib/src/enricher/enricher_event_processor.dart

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import '../../event_processor.dart';
2+
import '../../sentry_options.dart';
3+
import 'io_enricher_event_processor.dart'
4+
if (dart.library.html) 'web_enricher_event_processor.dart';
5+
6+
abstract class EnricherEventProcessor implements EventProcessor {
7+
factory EnricherEventProcessor(SentryOptions options) =>
8+
enricherEventProcessor(options);
9+
}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import 'dart:async';
22
import 'dart:io';
33
import 'dart:isolate';
44

5-
import '../event_processor.dart';
6-
import '../protocol.dart';
7-
import '../sentry_options.dart';
5+
import '../../protocol.dart';
6+
import '../../sentry_options.dart';
7+
import 'enricher_event_processor.dart';
88

9-
EventProcessor enricherEventProcessor(SentryOptions options) {
9+
EnricherEventProcessor enricherEventProcessor(SentryOptions options) {
1010
return IoEnricherEventProcessor(options);
1111
}
1212

1313
/// Enriches [SentryEvents] with various kinds of information.
1414
/// Uses Darts [Platform](https://api.dart.dev/stable/dart-io/Platform-class.html)
1515
/// class to read information.
16-
class IoEnricherEventProcessor extends EventProcessor {
16+
class IoEnricherEventProcessor implements EnricherEventProcessor {
1717
IoEnricherEventProcessor(
1818
this._options,
1919
);

dart/lib/src/enricher/web_enricher_event_processor.dart renamed to dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import 'dart:async';
22
import 'dart:html' as html show window, Window;
33

4-
import '../event_processor.dart';
5-
import '../protocol.dart';
6-
import '../sentry_options.dart';
4+
import '../../protocol.dart';
5+
import '../../sentry_options.dart';
6+
import 'enricher_event_processor.dart';
77

8-
EventProcessor enricherEventProcessor(SentryOptions options) {
8+
EnricherEventProcessor enricherEventProcessor(SentryOptions options) {
99
return WebEnricherEventProcessor(
1010
html.window,
1111
options,
1212
);
1313
}
1414

15-
class WebEnricherEventProcessor extends EventProcessor {
15+
class WebEnricherEventProcessor implements EnricherEventProcessor {
1616
WebEnricherEventProcessor(
1717
this._window,
1818
this._options,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import '../../event_processor.dart';
2+
import '../../sentry_options.dart';
3+
import 'io_exception_event_processor.dart'
4+
if (dart.library.html) 'web_exception_event_processor.dart';
5+
6+
abstract class ExceptionEventProcessor implements EventProcessor {
7+
factory ExceptionEventProcessor(SentryOptions options) =>
8+
exceptionEventProcessor(options);
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import 'dart:io';
2+
3+
import '../../protocol.dart';
4+
import '../../sentry_options.dart';
5+
import 'exception_event_processor.dart';
6+
7+
ExceptionEventProcessor exceptionEventProcessor(SentryOptions options) =>
8+
IoExceptionEventProcessor(options);
9+
10+
class IoExceptionEventProcessor implements ExceptionEventProcessor {
11+
IoExceptionEventProcessor(this._options);
12+
13+
final SentryOptions _options;
14+
15+
@override
16+
SentryEvent apply(SentryEvent event, {dynamic hint}) {
17+
final throwable = event.throwable;
18+
if (throwable is HttpException) {
19+
return _applyHttpException(throwable, event);
20+
}
21+
if (throwable is SocketException) {
22+
return _applySocketException(throwable, event);
23+
}
24+
if (throwable is FileSystemException) {
25+
return _applyFileSystemException(throwable, event);
26+
}
27+
28+
return event;
29+
}
30+
31+
// https://api.dart.dev/stable/dart-io/HttpException-class.html
32+
SentryEvent _applyHttpException(HttpException exception, SentryEvent event) {
33+
final uri = exception.uri;
34+
if (uri == null) {
35+
return event;
36+
}
37+
return event.copyWith(
38+
request: event.request ?? SentryRequest.fromUri(uri: uri),
39+
);
40+
}
41+
42+
// https://api.dart.dev/stable/dart-io/SocketException-class.html
43+
SentryEvent _applySocketException(
44+
SocketException exception,
45+
SentryEvent event,
46+
) {
47+
final address = exception.address;
48+
final osError = exception.osError;
49+
if (address == null) {
50+
return event.copyWith(
51+
exceptions: [
52+
// OSError is the underlying error
53+
// https://api.dart.dev/stable/dart-io/SocketException/osError.html
54+
// https://api.dart.dev/stable/dart-io/OSError-class.html
55+
if (osError != null) _sentryExceptionfromOsError(osError),
56+
...?event.exceptions,
57+
],
58+
);
59+
}
60+
SentryRequest? request;
61+
try {
62+
var uri = Uri.parse(address.host);
63+
request = SentryRequest.fromUri(uri: uri);
64+
} catch (exception, stackTrace) {
65+
_options.logger(
66+
SentryLevel.error,
67+
'Could not parse ${address.host} to Uri',
68+
exception: exception,
69+
stackTrace: stackTrace,
70+
);
71+
}
72+
73+
return event.copyWith(
74+
request: event.request ?? request,
75+
exceptions: [
76+
// OSError is the underlying error
77+
// https://api.dart.dev/stable/dart-io/SocketException/osError.html
78+
// https://api.dart.dev/stable/dart-io/OSError-class.html
79+
if (osError != null) _sentryExceptionfromOsError(osError),
80+
...?event.exceptions,
81+
],
82+
);
83+
}
84+
85+
// https://api.dart.dev/stable/dart-io/FileSystemException-class.html
86+
SentryEvent _applyFileSystemException(
87+
FileSystemException exception,
88+
SentryEvent event,
89+
) {
90+
final osError = exception.osError;
91+
return event.copyWith(
92+
exceptions: [
93+
// OSError is the underlying error
94+
// https://api.dart.dev/stable/dart-io/FileSystemException/osError.html
95+
// https://api.dart.dev/stable/dart-io/OSError-class.html
96+
if (osError != null) _sentryExceptionfromOsError(osError),
97+
...?event.exceptions,
98+
],
99+
);
100+
}
101+
}
102+
103+
SentryException _sentryExceptionfromOsError(OSError osError) {
104+
return SentryException(
105+
type: osError.runtimeType.toString(),
106+
value: osError.toString(),
107+
// osError.errorCode is likely a posix signal
108+
// https://develop.sentry.dev/sdk/event-payloads/types/#mechanismmeta
109+
mechanism: Mechanism(
110+
type: 'OSError',
111+
meta: {
112+
'errno': {'number': osError.errorCode},
113+
},
114+
),
115+
);
116+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import '../../protocol.dart';
2+
import '../../sentry_options.dart';
3+
import 'exception_event_processor.dart';
4+
5+
ExceptionEventProcessor exceptionEventProcessor(SentryOptions _) =>
6+
WebExcptionEventProcessor();
7+
8+
class WebExcptionEventProcessor implements ExceptionEventProcessor {
9+
@override
10+
SentryEvent apply(SentryEvent event, {dynamic hint}) => event;
11+
}

dart/lib/src/http_client/failed_request_client.dart

+7-16
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ class FailedRequestClient extends BaseClient {
7272
Client? client,
7373
Hub? hub,
7474
}) : _hub = hub ?? HubAdapter(),
75-
_client = client ?? Client();
75+
_client = client ?? Client() {
76+
if (captureFailedRequests) {
77+
_hub.options.sdk.addIntegration('HTTPClientError');
78+
}
79+
}
7680

7781
final Client _client;
7882
final Hub _hub;
@@ -154,29 +158,16 @@ class FailedRequestClient extends BaseClient {
154158
required BaseRequest request,
155159
required StreamedResponse? response,
156160
}) async {
157-
// As far as I can tell there's no way to get the uri without the query part
158-
// so we replace it with an empty string.
159-
final urlWithoutQuery = request.url
160-
.replace(query: '', fragment: '')
161-
.toString()
162-
.replaceAll('?', '')
163-
.replaceAll('#', '');
164-
165-
final query = request.url.query.isEmpty ? null : request.url.query;
166-
final fragment = request.url.fragment.isEmpty ? null : request.url.fragment;
167-
168-
final sentryRequest = SentryRequest(
161+
final sentryRequest = SentryRequest.fromUri(
169162
method: request.method,
170163
headers: sendDefaultPii ? request.headers : null,
171-
url: urlWithoutQuery,
172-
queryString: query,
164+
uri: request.url,
173165
data: sendDefaultPii ? _getDataFromRequest(request) : null,
174166
// ignore: deprecated_member_use_from_same_package
175167
other: {
176168
'content_length': request.contentLength.toString(),
177169
'duration': requestDuration.toString(),
178170
},
179-
fragment: fragment,
180171
);
181172

182173
final mechanism = Mechanism(

dart/lib/src/http_client/sentry_http_client.dart

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class SentryHttpClient extends BaseClient {
101101

102102
if (networkTracing) {
103103
innerClient = TracingClient(client: innerClient, hub: _hub);
104+
_hub.options.sdk.addIntegration('HTTPNetworkTracing');
104105
}
105106

106107
// The ordering here matters.

0 commit comments

Comments
 (0)