Skip to content

Commit 2baf2a4

Browse files
committed
Merge branch 'main' into feat/multiview-aware
2 parents 1d57db2 + 515c540 commit 2baf2a4

Some content is hidden

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

47 files changed

+275
-337
lines changed

.github/workflows/flutter_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
uses: actions/checkout@v4
174174

175175
- name: Install Chrome Browser
176-
uses: browser-actions/setup-chrome@facf10a55b9caf92e0cc749b4f82bf8220989148 # [email protected].2
176+
uses: browser-actions/setup-chrome@c785b87e244131f27c9f19c1a33e2ead956ab7ce # [email protected].3
177177
with:
178178
chrome-version: stable
179179
- run: chrome --version

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Get auth token
2121
id: token
22-
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
22+
uses: actions/create-github-app-token@67e27a7eb7db372a1c61a7f9bdab8699e9ee57f7 # v1.11.3
2323
with:
2424
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
2525
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

.github/workflows/testflight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # [email protected]
1818
- run: xcodes select 15.0.1
19-
- uses: ruby/setup-ruby@1287d2b408066abada82d5ad1c63652e758428d9 # pin@v1.214.0
19+
- uses: ruby/setup-ruby@d781c1b4ed31764801bfae177617bb0446f5ef8d # pin@v1.218.0
2020
with:
2121
ruby-version: '2.7.5'
2222
bundler-cache: true

CHANGELOG.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,74 @@
55
### Features
66

77
- Disable `ScreenshotIntegration`, `WidgetsBindingIntegration` and `SentryWidget` in multi-view apps #2366 ([#2366](https://github.com/getsentry/sentry-dart/pull/2366))
8+
### Other
9+
10+
- Remove macOS display refresh rate support ([#2628](https://github.com/getsentry/sentry-dart/pull/2628))
11+
- Can't reliably detect on multi-monitor systems and on older macOS versions.
12+
- Not very meaningful, as other applications may be running in parallel and affecting it.
13+
14+
### Dependencies
15+
16+
- Bump Native SDK from v0.7.19 to v0.7.20 ([#2652](https://github.com/getsentry/sentry-dart/pull/2652))
17+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0720)
18+
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.19...0.7.20)
19+
20+
## 8.13.0
21+
22+
### Breaking changes
23+
24+
- Remove Metrics API ([#2571](https://github.com/getsentry/sentry-dart/pull/2571))
25+
- The Metrics product never reached maturity from beta and has officially ended in October 7th, 2024
26+
- Read [this post](https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Metrics-Beta-Ended-on-October-7th) for more information
27+
28+
### Features
29+
30+
- Add `beforeCapture` for View Hierarchy ([#2523](https://github.com/getsentry/sentry-dart/pull/2523))
31+
- View hierarchy calls are now debounced for 2 seconds.
32+
- JS SDK integration ([#2572](https://github.com/getsentry/sentry-dart/pull/2572))
33+
- Enable the integration by setting `options.enableSentryJs = true`
34+
- Features:
35+
- Sending envelopes through Sentry JS transport layer
36+
- Capturing native JS errors
37+
- Add SentryReplayQuality setting (`options.experimental.replay.quality`) ([#2582](https://github.com/getsentry/sentry-dart/pull/2582))
38+
- SPM Support ([#2280](https://github.com/getsentry/sentry-dart/pull/2280))
39+
40+
### Enhancements
41+
42+
- Replay: improve iOS native interop performance ([#2530](https://github.com/getsentry/sentry-dart/pull/2530), [#2573](https://github.com/getsentry/sentry-dart/pull/2573))
43+
- Replay: improve orientation change tracking accuracy on Android ([#2540](https://github.com/getsentry/sentry-dart/pull/2540))
44+
- Print a warning if the rate limit was reached ([#2595](https://github.com/getsentry/sentry-dart/pull/2595))
45+
- Add replay masking config to tags and report SDKs versions ([#2592](https://github.com/getsentry/sentry-dart/pull/2592))
46+
- Enable `options.debug` when in debug mode ([#2597](https://github.com/getsentry/sentry-dart/pull/2597))
47+
- Propagate sample seed in baggage header ([#2629](https://github.com/getsentry/sentry-dart/pull/2629))
48+
- Read more about the specs [here](https://develop.sentry.dev/sdk/telemetry/traces/#propagated-random-value)
49+
- Finish and start new transaction when tapping same element again ([#2623](https://github.com/getsentry/sentry-dart/pull/2623))
50+
51+
### Fixes
52+
53+
- Replay: fix masking for frames captured during UI changes ([#2553](https://github.com/getsentry/sentry-dart/pull/2553), [#2657](https://github.com/getsentry/sentry-dart/pull/2657))
54+
- Replay: fix widget masks overlap when navigating between screens ([#2486](https://github.com/getsentry/sentry-dart/pull/2486), [#2576](https://github.com/getsentry/sentry-dart/pull/2576))
55+
- WASM compat for Drift ([#2580](https://github.com/getsentry/sentry-dart/pull/2580))
56+
- Fix image flickering when using `SentryAssetBundle` ([#2577](https://github.com/getsentry/sentry-dart/pull/2577))
57+
- Fix print recursion detection ([#2624](https://github.com/getsentry/sentry-dart/pull/2624))
58+
59+
### Misc
60+
61+
- Transfer ownership of `sentry_link` to Sentry. You can view the changelog for the previous versions [here](https://github.com/getsentry/sentry-dart/blob/main/link/CHANGELOG_OLD.md) ([#2338](https://github.com/getsentry/sentry-dart/pull/2338))
62+
- No functional changes have been made. This version is identical to the previous one.
63+
- Change license from Apache to MIT
864

965
### Dependencies
1066

11-
- Bump Cocoa SDK from v8.44.0-beta.1 to v8.44.0 ([#2649](https://github.com/getsentry/sentry-dart/pull/2649))
67+
- Bump Native SDK from v0.7.17 to v0.7.19 ([#2578](https://github.com/getsentry/sentry-dart/pull/2578), [#2588](https://github.com/getsentry/sentry-dart/pull/2588))
68+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0719)
69+
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.17...0.7.19)
70+
- Bump Android SDK from v7.19.0 to v7.20.1 ([#2536](https://github.com/getsentry/sentry-dart/pull/2536), [#2549](https://github.com/getsentry/sentry-dart/pull/2549), [#2593](https://github.com/getsentry/sentry-dart/pull/2593))
71+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7201)
72+
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.0...7.20.1)
73+
- Bump Cocoa SDK from v8.42.0 to v8.44.0 ([#2542](https://github.com/getsentry/sentry-dart/pull/2542), [#2548](https://github.com/getsentry/sentry-dart/pull/2548), [#2598](https://github.com/getsentry/sentry-dart/pull/2598), [#2649](https://github.com/getsentry/sentry-dart/pull/2649))
1274
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8440)
13-
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.44.0-beta.1...8.44.0)
75+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.42.0...8.44.0)
1476

1577
## 8.13.0-beta.3
1678

dart/lib/src/sentry_baggage.dart

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import 'package:meta/meta.dart';
2-
import 'scope.dart';
32
import 'protocol.dart';
4-
3+
import 'scope.dart';
54
import 'sentry_options.dart';
65

76
class SentryBaggage {
87
static const String _sampleRateKeyName = 'sentry-sample_rate';
8+
static const String _sampleRandKeyName = 'sentry-sample_rand';
9+
910
static const int _maxChars = 8192;
1011
static const int _maxListMember = 64;
1112

@@ -194,6 +195,10 @@ class SentryBaggage {
194195
set(_sampleRateKeyName, value);
195196
}
196197

198+
void setSampleRand(String value) {
199+
set(_sampleRandKeyName, value);
200+
}
201+
197202
void setSampled(String value) {
198203
set('sentry-sampled', value);
199204
}
@@ -207,6 +212,15 @@ class SentryBaggage {
207212
return double.tryParse(sampleRate);
208213
}
209214

215+
double? getSampleRand() {
216+
final sampleRand = get(_sampleRandKeyName);
217+
if (sampleRand == null) {
218+
return null;
219+
}
220+
221+
return double.tryParse(sampleRand);
222+
}
223+
210224
void setReplayId(String value) => set('sentry-replay_id', value);
211225

212226
SentryId? getReplayId() {

dart/lib/src/sentry_run_zoned_guarded.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SentryRunZonedGuarded {
2929

3030
final sentryZoneSpecification = ZoneSpecification.from(
3131
zoneSpecification ?? ZoneSpecification(),
32-
print: (self, parent, zone, line) async {
32+
print: (self, parent, zone, line) {
3333
final options = hub.options;
3434

3535
if (userPrint != null) {
@@ -61,12 +61,12 @@ class SentryRunZonedGuarded {
6161

6262
try {
6363
_isPrinting = true;
64-
await hub.addBreadcrumb(
64+
unawaited(hub.addBreadcrumb(
6565
Breadcrumb.console(
6666
message: line,
6767
level: SentryLevel.debug,
6868
),
69-
);
69+
));
7070
parent.print(zone, line);
7171
} finally {
7272
_isPrinting = false;

dart/lib/src/sentry_trace_context_header.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:meta/meta.dart';
22

3-
import 'protocol/sentry_id.dart';
43
import 'protocol/access_aware_map.dart';
4+
import 'protocol/sentry_id.dart';
55
import 'sentry_baggage.dart';
66
import 'sentry_options.dart';
77

@@ -15,6 +15,7 @@ class SentryTraceContextHeader {
1515
this.userSegment,
1616
this.transaction,
1717
this.sampleRate,
18+
this.sampleRand,
1819
this.sampled,
1920
this.unknown,
2021
this.replayId,
@@ -30,6 +31,7 @@ class SentryTraceContextHeader {
3031
final String? userSegment;
3132
final String? transaction;
3233
final String? sampleRate;
34+
final String? sampleRand;
3335
final String? sampled;
3436

3537
@internal
@@ -102,6 +104,9 @@ class SentryTraceContextHeader {
102104
if (sampleRate != null) {
103105
baggage.setSampleRate(sampleRate!);
104106
}
107+
if (sampleRand != null) {
108+
baggage.setSampleRand(sampleRand!);
109+
}
105110
if (sampled != null) {
106111
baggage.setSampled(sampled!);
107112
}
@@ -113,6 +118,7 @@ class SentryTraceContextHeader {
113118

114119
factory SentryTraceContextHeader.fromBaggage(SentryBaggage baggage) {
115120
return SentryTraceContextHeader(
121+
// TODO: implement and use proper get methods here
116122
SentryId.fromId(baggage.get('sentry-trace_id').toString()),
117123
baggage.get('sentry-public_key').toString(),
118124
release: baggage.get('sentry-release'),

dart/lib/src/sentry_tracer.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ class SentryTracer extends ISentrySpan {
385385
transaction:
386386
_isHighQualityTransactionName(transactionNameSource) ? name : null,
387387
sampleRate: _sampleRateToString(_rootSpan.samplingDecision?.sampleRate),
388+
sampleRand: _sampleRandToString(_rootSpan.samplingDecision?.sampleRand),
388389
sampled: _rootSpan.samplingDecision?.sampled.toString(),
389390
);
390391

@@ -398,6 +399,13 @@ class SentryTracer extends ISentrySpan {
398399
return sampleRate != null ? SampleRateFormat().format(sampleRate) : null;
399400
}
400401

402+
String? _sampleRandToString(double? sampleRand) {
403+
if (!isValidSampleRand(sampleRand)) {
404+
return null;
405+
}
406+
return sampleRand != null ? SampleRateFormat().format(sampleRand) : null;
407+
}
408+
401409
bool _isHighQualityTransactionName(SentryTransactionNameSource source) {
402410
return source != SentryTransactionNameSource.url;
403411
}

dart/lib/src/sentry_traces_sampler.dart

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,9 @@ class SentryTracesSampler {
3131
final tracesSampler = _options.tracesSampler;
3232
if (tracesSampler != null) {
3333
try {
34-
final result = tracesSampler(samplingContext);
35-
if (result != null) {
36-
return SentryTracesSamplingDecision(
37-
_sample(result),
38-
sampleRate: result,
39-
);
34+
final sampleRate = tracesSampler(samplingContext);
35+
if (sampleRate != null) {
36+
return _makeSampleDecision(sampleRate);
4037
}
4138
} catch (exception, stackTrace) {
4239
_options.logger(
@@ -64,10 +61,7 @@ class SentryTracesSampler {
6461
double? optionsOrDefaultRate = optionsRate ?? defaultRate;
6562

6663
if (optionsOrDefaultRate != null) {
67-
return SentryTracesSamplingDecision(
68-
_sample(optionsOrDefaultRate),
69-
sampleRate: optionsOrDefaultRate,
70-
);
64+
return _makeSampleDecision(optionsOrDefaultRate);
7165
}
7266

7367
return SentryTracesSamplingDecision(false);
@@ -78,8 +72,18 @@ class SentryTracesSampler {
7872
if (optionsRate == null || !tracesSamplingDecision.sampled) {
7973
return false;
8074
}
81-
return _sample(optionsRate);
75+
return _isSampled(optionsRate);
8276
}
8377

84-
bool _sample(double result) => !(result < _random.nextDouble());
78+
SentryTracesSamplingDecision _makeSampleDecision(double sampleRate) {
79+
final sampleRand = _random.nextDouble();
80+
final sampled = _isSampled(sampleRate, sampleRand: sampleRand);
81+
return SentryTracesSamplingDecision(sampled,
82+
sampleRate: sampleRate, sampleRand: sampleRand);
83+
}
84+
85+
bool _isSampled(double sampleRate, {double? sampleRand}) {
86+
final rand = sampleRand ?? _random.nextDouble();
87+
return rand <= sampleRate;
88+
}
8589
}

dart/lib/src/sentry_traces_sampling_decision.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ class SentryTracesSamplingDecision {
22
SentryTracesSamplingDecision(
33
this.sampled, {
44
this.sampleRate,
5+
this.sampleRand,
56
});
67

78
final bool sampled;
89
final double? sampleRate;
10+
final double? sampleRand;
911
}

dart/lib/src/sentry_transaction_context.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import 'package:meta/meta.dart';
2-
import 'sentry_trace_origins.dart';
32

43
import 'protocol.dart';
54
import 'sentry_baggage.dart';
5+
import 'sentry_trace_origins.dart';
66
import 'tracing.dart';
77

88
@immutable
99
class SentryTransactionContext extends SentrySpanContext {
1010
final String name;
11-
final SentryTracesSamplingDecision? parentSamplingDecision;
1211
final SentryTransactionNameSource? transactionNameSource;
1312
final SentryTracesSamplingDecision? samplingDecision;
13+
final SentryTracesSamplingDecision? parentSamplingDecision;
1414

1515
SentryTransactionContext(
1616
this.name,
1717
String operation, {
1818
super.description,
19-
this.parentSamplingDecision,
2019
super.traceId,
2120
super.spanId,
2221
super.parentSpanId,
2322
this.transactionNameSource,
2423
this.samplingDecision,
24+
this.parentSamplingDecision,
2525
super.origin,
2626
}) : super(
2727
operation: operation,
@@ -35,6 +35,7 @@ class SentryTransactionContext extends SentrySpanContext {
3535
SentryBaggage? baggage,
3636
}) {
3737
final sampleRate = baggage?.getSampleRate();
38+
final sampleRand = baggage?.getSampleRand();
3839
return SentryTransactionContext(
3940
name,
4041
operation,
@@ -44,6 +45,7 @@ class SentryTransactionContext extends SentrySpanContext {
4445
? SentryTracesSamplingDecision(
4546
traceHeader.sampled!,
4647
sampleRate: sampleRate,
48+
sampleRand: sampleRand,
4749
)
4850
: null,
4951
transactionNameSource:

dart/lib/src/utils/tracing_utils.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,10 @@ bool isValidSampleRate(double? sampleRate) {
8080
}
8181
return !sampleRate.isNaN && sampleRate >= 0.0 && sampleRate <= 1.0;
8282
}
83+
84+
bool isValidSampleRand(double? sampleRand) {
85+
if (sampleRand == null) {
86+
return false;
87+
}
88+
return !sampleRand.isNaN && sampleRand >= 0.0 && sampleRand < 1.0;
89+
}

dart/lib/src/version.dart

Lines changed: 1 addition & 1 deletion
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 = '8.13.0-beta.3';
12+
const String sdkVersion = '8.13.0';
1313

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

dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sentry
2-
version: 8.13.0-beta.3
2+
version: 8.13.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/sentry_baggage_header_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ void main() {
2121
baggage.setUserSegment('userSegment');
2222
baggage.setTransaction('transaction');
2323
baggage.setSampleRate('1.0');
24+
baggage.setSampleRand('0.4');
2425
baggage.setSampled('false');
2526
final replayId = SentryId.newId().toString();
2627
baggage.setReplayId(replayId);
@@ -37,6 +38,7 @@ void main() {
3738
'sentry-user_segment=userSegment,'
3839
'sentry-transaction=transaction,'
3940
'sentry-sample_rate=1.0,'
41+
'sentry-sample_rand=0.4,'
4042
'sentry-sampled=false,'
4143
'sentry-replay_id=$replayId');
4244
});

0 commit comments

Comments
 (0)