Skip to content

Commit 6f1f672

Browse files
committed
Merge branch 'main' into enha/user-unhandled
2 parents db2b18e + 0aaa46e commit 6f1f672

Some content is hidden

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

46 files changed

+929
-223
lines changed

.github/workflows/flutter_integration_test.yml

Lines changed: 74 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,71 +21,97 @@ jobs:
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
48+
49+
- name: Gradle cache
50+
uses: gradle/gradle-build-action@v2
51+
52+
- name: AVD cache
53+
uses: actions/cache@v3
54+
id: avd-cache
55+
with:
56+
path: |
57+
~/.android/avd/*
58+
~/.android/adb*
59+
key: avd-21
60+
61+
- name: create AVD and generate snapshot for caching
62+
if: steps.avd-cache.outputs.cache-hit != 'true'
63+
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #[email protected]
64+
with:
65+
working-directory: ./flutter/example
66+
api-level: 21
67+
force-avd-creation: false
68+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
69+
disable-animations: false
70+
arch: x86_64
71+
profile: Nexus 6
72+
script: echo "Generated AVD snapshot for caching."
4873

4974
- name: launch android emulator & run android integration test
50-
uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 #pin@v2.27.0
75+
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #pin@v2.28.0
5176
with:
5277
working-directory: ./flutter/example
5378
api-level: 21
79+
force-avd-creation: false
80+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
81+
disable-animations: true
5482
arch: x86_64
5583
profile: Nexus 6
5684
script: flutter test integration_test/integration_test.dart --verbose
5785

58-
# Enable after fixing https://github.com/getsentry/sentry-dart/issues/1448
59-
# test-ios:
60-
# runs-on: macos-latest
61-
# timeout-minutes: 30
62-
# defaults:
63-
# run:
64-
# working-directory: ./flutter/example
65-
# strategy:
66-
# fail-fast: false
67-
# matrix:
68-
# # 'beta' is flaky because of https://github.com/flutter/flutter/issues/124340
69-
# sdk: ['stable']
70-
# steps:
71-
# - name: checkout
72-
# uses: actions/checkout@v3
86+
test-ios:
87+
runs-on: macos-13
88+
timeout-minutes: 30
89+
defaults:
90+
run:
91+
working-directory: ./flutter/example
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
# 'beta' is flaky because of https://github.com/flutter/flutter/issues/124340
96+
sdk: ['stable']
97+
steps:
98+
- name: checkout
99+
uses: actions/checkout@v3
73100

74-
# - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
75-
# with:
76-
# channel: ${{ matrix.sdk }}
101+
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
102+
with:
103+
channel: ${{ matrix.sdk }}
77104

78-
# - name: flutter upgrade
79-
# run: flutter upgrade
105+
- name: flutter upgrade
106+
run: flutter upgrade
80107

81-
# - name: flutter pub get
82-
# run: flutter pub get
108+
- name: flutter pub get
109+
run: flutter pub get
83110

84-
# - name: launch ios emulator
85-
# uses: futureware-tech/simulator-action@ee05c113b79f056b47f354d7b313555f5491e158 #pin@v2
86-
# with:
87-
# model: 'iPhone 14'
88-
# os_version: '16.2'
111+
- name: launch ios simulator
112+
run: |
113+
simulator_id=$(xcrun simctl create sentryPhone com.apple.CoreSimulator.SimDeviceType.iPhone-14 com.apple.CoreSimulator.SimRuntime.iOS-16-2)
114+
xcrun simctl boot ${simulator_id}
89115
90-
# - name: run ios integration test
91-
# run: flutter test integration_test/integration_test.dart --verbose
116+
- name: run ios integration test
117+
run: flutter test integration_test/integration_test.dart --verbose

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77
- Mark exceptions not handled by user as `handled: false` ([#1535](https://github.com/getsentry/sentry-dart/pull/1535))
88
- This will affect your release health data, and is therefore considered a breaking change.
99

10+
### Features
11+
12+
- Send trace origin ([#1534](https://github.com/getsentry/sentry-dart/pull/1534))
13+
14+
[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.
15+
16+
### Dependencies
17+
18+
- Bump Cocoa SDK from v8.8.0 to v8.9.1 ([#1553](https://github.com/getsentry/sentry-dart/pull/1553))
19+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#891)
20+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.8.0...8.9.1)
21+
- Bump Android SDK from v6.23.0 to v6.25.2 ([#1554](https://github.com/getsentry/sentry-dart/pull/1554))
22+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6252)
23+
- [diff](https://github.com/getsentry/sentry-java/compare/6.23.0...6.25.2)
24+
1025
## 7.8.0
1126

1227
### Enhancements

dart/lib/sentry.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ export 'src/utils/http_sanitizer.dart';
4444
export 'src/utils/url_details.dart';
4545
// ignore: invalid_export_of_internal_element
4646
export 'src/utils/http_header_utils.dart';
47+
// ignore: invalid_export_of_internal_element
48+
export 'src/sentry_trace_origins.dart';

dart/lib/src/http_client/tracing_client.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:http/http.dart';
22
import '../hub.dart';
33
import '../hub_adapter.dart';
44
import '../protocol.dart';
5+
import '../sentry_trace_origins.dart';
56
import '../tracing.dart';
67
import '../utils/tracing_utils.dart';
78
import '../utils/http_sanitizer.dart';
@@ -33,6 +34,7 @@ class TracingClient extends BaseClient {
3334
'http.client',
3435
description: description,
3536
);
37+
span?.origin = SentryTraceOrigins.autoHttpHttp;
3638

3739
// if the span is NoOp, we don't want to attach headers
3840
if (span is NoOpSentrySpan) {

dart/lib/src/hub.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ class Hub {
398398
name,
399399
operation,
400400
description: description,
401+
origin: SentryTraceOrigins.manual,
401402
),
402403
startTimestamp: startTimestamp,
403404
bindToScope: bindToScope,
@@ -442,6 +443,12 @@ class Hub {
442443
transactionContext.copyWith(samplingDecision: samplingDecision);
443444
}
444445

446+
if (transactionContext.origin == null) {
447+
transactionContext = transactionContext.copyWith(
448+
origin: SentryTraceOrigins.manual,
449+
);
450+
}
451+
445452
final tracer = SentryTracer(
446453
transactionContext,
447454
this,

dart/lib/src/noop_sentry_span.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ class NoOpSentrySpan extends ISentrySpan {
5151
@override
5252
SentrySpanContext get context => _spanContext;
5353

54+
@override
55+
String? get origin => null;
56+
57+
@override
58+
set origin(String? origin) {}
59+
5460
@override
5561
SpanStatus? get status => null;
5662

dart/lib/src/protocol/sentry_span.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class SentrySpan extends ISentrySpan {
3636
}) {
3737
_startTimestamp = startTimestamp?.toUtc() ?? _hub.options.clock();
3838
_finishedCallback = finishedCallback;
39+
_origin = _context.origin;
3940
}
4041

4142
@override
@@ -145,6 +146,14 @@ class SentrySpan extends ISentrySpan {
145146
@override
146147
SentrySpanContext get context => _context;
147148

149+
String? _origin;
150+
151+
@override
152+
String? get origin => _origin;
153+
154+
@override
155+
set origin(String? origin) => _origin = origin;
156+
148157
Map<String, dynamic> toJson() {
149158
final json = _context.toJson();
150159
json['start_timestamp'] =
@@ -162,6 +171,9 @@ class SentrySpan extends ISentrySpan {
162171
if (_tags.isNotEmpty) {
163172
json['tags'] = _tags;
164173
}
174+
if (_origin != null) {
175+
json['origin'] = _origin;
176+
}
165177
return json;
166178
}
167179

dart/lib/src/protocol/sentry_trace_context.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class SentryTraceContext {
2828
/// The Span status
2929
final SpanStatus? status;
3030

31+
/// The origin of the span indicates what created the span.
32+
///
33+
/// @note Gets set by the SDK. It is not expected to be set manually by users.
34+
///
35+
/// @see <https://develop.sentry.dev/sdk/performance/trace-origin>
36+
final String? origin;
37+
3138
factory SentryTraceContext.fromJson(Map<String, dynamic> json) {
3239
return SentryTraceContext(
3340
operation: json['op'] as String,
@@ -41,6 +48,7 @@ class SentryTraceContext {
4148
? null
4249
: SpanStatus.fromString(json['status'] as String),
4350
sampled: true,
51+
origin: json['origin'] == null ? null : json['origin'] as String?,
4452
);
4553
}
4654

@@ -53,6 +61,7 @@ class SentryTraceContext {
5361
if (parentSpanId != null) 'parent_span_id': parentSpanId!.toString(),
5462
if (description != null) 'description': description,
5563
if (status != null) 'status': status!.toString(),
64+
if (origin != null) 'origin': origin,
5665
};
5766
}
5867

@@ -64,6 +73,7 @@ class SentryTraceContext {
6473
status: status,
6574
parentSpanId: parentSpanId,
6675
sampled: sampled,
76+
origin: origin,
6777
);
6878

6979
SentryTraceContext({
@@ -74,6 +84,7 @@ class SentryTraceContext {
7484
required this.operation,
7585
this.description,
7686
this.status,
87+
this.origin,
7788
}) : traceId = traceId ?? SentryId.newId(),
7889
spanId = spanId ?? SpanId.newId();
7990
}

dart/lib/src/sentry_span_context.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ class SentrySpanContext {
2020
/// consistent across instances of the span.
2121
final String? description;
2222

23+
/// The origin of the span indicates what created the span.
24+
///
25+
/// Gets set by the SDK. It is not expected to be set manually by users.
26+
///
27+
/// See https://develop.sentry.dev/sdk/performance/trace-origin
28+
final String? origin;
29+
2330
/// Item encoded as JSON
2431
Map<String, dynamic> toJson() {
2532
return {
@@ -28,6 +35,7 @@ class SentrySpanContext {
2835
'op': operation,
2936
if (parentSpanId != null) 'parent_span_id': parentSpanId.toString(),
3037
if (description != null) 'description': description,
38+
if (origin != null) 'origin': origin,
3139
};
3240
}
3341

@@ -37,6 +45,7 @@ class SentrySpanContext {
3745
this.parentSpanId,
3846
required this.operation,
3947
this.description,
48+
this.origin,
4049
}) : traceId = traceId ?? SentryId.newId(),
4150
spanId = spanId ?? SpanId.newId();
4251

@@ -53,6 +62,7 @@ class SentrySpanContext {
5362
parentSpanId: parentSpanId,
5463
sampled: sampled,
5564
status: status,
65+
origin: origin,
5666
);
5767
}
5868
}

dart/lib/src/sentry_span_interface.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ abstract class ISentrySpan {
3636
/// Gets the span context.
3737
SentrySpanContext get context;
3838

39+
/// Gets the span origin
40+
String? get origin;
41+
42+
/// Sets span origin.
43+
///
44+
/// Gets set by the SDK. It is not expected to be set manually by users.
45+
///
46+
/// See https://develop.sentry.dev/sdk/performance/trace-origin
47+
set origin(String? origin);
48+
3949
/// Returns the end timestamp if finished
4050
DateTime? get endTimestamp;
4151

0 commit comments

Comments
 (0)