Skip to content

Commit 2e93bab

Browse files
authored
chore: rename errorSampleRate to onErrorSampleRate (#2270)
* chore: rename errorSampleRate to onErrorSampleRate * Update CHANGELOG.md
1 parent 7efd9cf commit 2e93bab

File tree

11 files changed

+20
-21
lines changed

11 files changed

+20
-21
lines changed

CHANGELOG.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
### Features
66

7-
- Session replay Alpha for Android and iOS ([#2208](https://github.com/getsentry/sentry-dart/pull/2208), [#2269](https://github.com/getsentry/sentry-dart/pull/2269), [#2236](https://github.com/getsentry/sentry-dart/pull/2236), [#2275](https://github.com/getsentry/sentry-dart/pull/2275).
8-
7+
- Session replay Alpha for Android and iOS ([#2208](https://github.com/getsentry/sentry-dart/pull/2208), [#2269](https://github.com/getsentry/sentry-dart/pull/2269), [#2236](https://github.com/getsentry/sentry-dart/pull/2236), [#2275](https://github.com/getsentry/sentry-dart/pull/2275), [#2270](https://github.com/getsentry/sentry-dart/pull/2270)).
98
To try out replay, you can set following options (access is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)):
109

1110
```dart
1211
await SentryFlutter.init(
1312
(options) {
1413
...
1514
options.experimental.replay.sessionSampleRate = 1.0;
16-
options.experimental.replay.errorSampleRate = 1.0;
15+
options.experimental.replay.onErrorSampleRate = 1.0;
1716
},
1817
appRunner: () => runApp(MyApp()),
1918
);
@@ -205,7 +204,7 @@ SentryNavigatorObserver(ignoreRoutes: ["/ignoreThisRoute"]),
205204
(options) {
206205
...
207206
options.experimental.replay.sessionSampleRate = 1.0;
208-
options.experimental.replay.errorSampleRate = 1.0;
207+
options.experimental.replay.onErrorSampleRate = 1.0;
209208
},
210209
appRunner: () => runApp(MyApp()),
211210
);

flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutter.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class SentryFlutter(
158158
data: Map<String, Any>,
159159
) {
160160
options.sessionSampleRate = data["sessionSampleRate"] as? Double
161-
options.errorSampleRate = data["errorSampleRate"] as? Double
161+
options.errorSampleRate = data["onErrorSampleRate"] as? Double
162162
}
163163
}
164164

flutter/android/src/test/kotlin/io/sentry/flutter/SentryFlutterTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class Fixture {
155155
"replay" to
156156
mapOf(
157157
"sessionSampleRate" to 0.5,
158-
"errorSampleRate" to 0.6,
158+
"onErrorSampleRate" to 0.6,
159159
),
160160
)
161161

flutter/example/lib/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Future<void> setupSentry(
9191
options.navigatorKey = navigatorKey;
9292

9393
options.experimental.replay.sessionSampleRate = 1.0;
94-
options.experimental.replay.errorSampleRate = 1.0;
94+
options.experimental.replay.onErrorSampleRate = 1.0;
9595

9696
_isIntegrationTest = isIntegrationTest;
9797
if (_isIntegrationTest) {

flutter/ios/Classes/SentryFlutter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public final class SentryFlutter {
110110
options.experimental.sessionReplay.sessionSampleRate =
111111
(replayOptions["sessionSampleRate"] as? NSNumber)?.floatValue ?? 0
112112
options.experimental.sessionReplay.onErrorSampleRate =
113-
(replayOptions["errorSampleRate"] as? NSNumber)?.floatValue ?? 0
113+
(replayOptions["onErrorSampleRate"] as? NSNumber)?.floatValue ?? 0
114114
}
115115
#endif
116116
}

flutter/lib/src/native/cocoa/sentry_native_cocoa.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SentryNativeCocoa extends SentryNativeChannel {
2626
if (options.experimental.replay.isEnabled &&
2727
options.platformChecker.platform.isIOS) {
2828
// We only need the integration when error-replay capture is enabled.
29-
if ((options.experimental.replay.errorSampleRate ?? 0) > 0) {
29+
if ((options.experimental.replay.onErrorSampleRate ?? 0) > 0) {
3030
options.addEventProcessor(ReplayEventProcessor(this));
3131
}
3232

flutter/lib/src/native/java/sentry_native_java.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SentryNativeJava extends SentryNativeChannel {
2424
// so let's set it up conditionally. This allows Dart to trim the code.
2525
if (options.experimental.replay.isEnabled) {
2626
// We only need the integration when error-replay capture is enabled.
27-
if ((options.experimental.replay.errorSampleRate ?? 0) > 0) {
27+
if ((options.experimental.replay.onErrorSampleRate ?? 0) > 0) {
2828
options.addEventProcessor(ReplayEventProcessor(this));
2929
}
3030

flutter/lib/src/native/sentry_native_channel.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class SentryNativeChannel
6969
if (options.proxy != null) 'proxy': options.proxy?.toJson(),
7070
'replay': <String, dynamic>{
7171
'sessionSampleRate': options.experimental.replay.sessionSampleRate,
72-
'errorSampleRate': options.experimental.replay.errorSampleRate,
72+
'onErrorSampleRate': options.experimental.replay.onErrorSampleRate,
7373
},
7474
});
7575
}

flutter/lib/src/sentry_replay_options.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ class SentryReplayOptions {
1313
_sessionSampleRate = value;
1414
}
1515

16-
double? _errorSampleRate;
16+
double? _onErrorSampleRate;
1717

1818
/// A percentage of errors that will be accompanied by a 30 seconds replay.
1919
/// The value needs to be >= 0.0 and <= 1.0.
2020
/// Specifying 0 means none, 1.0 means 100 %. Defaults to null (disabled).
21-
double? get errorSampleRate => _errorSampleRate;
22-
set errorSampleRate(double? value) {
21+
double? get onErrorSampleRate => _onErrorSampleRate;
22+
set onErrorSampleRate(double? value) {
2323
assert(value == null || (value >= 0 && value <= 1));
24-
_errorSampleRate = value;
24+
_onErrorSampleRate = value;
2525
}
2626

2727
/// Redact all text content. Draws a rectangle of text bounds with text color
@@ -36,5 +36,5 @@ class SentryReplayOptions {
3636

3737
@internal
3838
bool get isEnabled =>
39-
((sessionSampleRate ?? 0) > 0) || ((errorSampleRate ?? 0) > 0);
39+
((sessionSampleRate ?? 0) > 0) || ((onErrorSampleRate ?? 0) > 0);
4040
}

flutter/test/integrations/init_native_sdk_test.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void main() {
6767
'appHangTimeoutIntervalMillis': 2000,
6868
'replay': <String, dynamic>{
6969
'sessionSampleRate': null,
70-
'errorSampleRate': null,
70+
'onErrorSampleRate': null,
7171
},
7272
});
7373
});
@@ -118,7 +118,7 @@ void main() {
118118
pass: '0000',
119119
)
120120
..experimental.replay.sessionSampleRate = 0.1
121-
..experimental.replay.errorSampleRate = 0.2;
121+
..experimental.replay.onErrorSampleRate = 0.2;
122122

123123
fixture.options.sdk.addIntegration('foo');
124124
fixture.options.sdk.addPackage('bar', '1');
@@ -172,7 +172,7 @@ void main() {
172172
},
173173
'replay': <String, dynamic>{
174174
'sessionSampleRate': 0.1,
175-
'errorSampleRate': 0.2,
175+
'onErrorSampleRate': 0.2,
176176
},
177177
});
178178
});

flutter/test/replay/replay_native_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void main() {
7676

7777
test('init sets $ReplayEventProcessor when error replay is enabled',
7878
() async {
79-
options.experimental.replay.errorSampleRate = 0.1;
79+
options.experimental.replay.onErrorSampleRate = 0.1;
8080
await sut.init(hub);
8181

8282
expect(options.eventProcessors.map((e) => e.runtimeType.toString()),
@@ -95,7 +95,7 @@ void main() {
9595
group('replay recorder', () {
9696
setUp(() async {
9797
options.experimental.replay.sessionSampleRate = 0.1;
98-
options.experimental.replay.errorSampleRate = 0.1;
98+
options.experimental.replay.onErrorSampleRate = 0.1;
9999
await sut.init(hub);
100100
});
101101

0 commit comments

Comments
 (0)