Skip to content

Commit

Permalink
chore: rename errorSampleRate to onErrorSampleRate
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Sep 4, 2024
1 parent 3a16179 commit f1e03bb
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(options) {
...
options.experimental.replay.sessionSampleRate = 1.0;
options.experimental.replay.errorSampleRate = 1.0;
options.experimental.replay.onErrorSampleRate = 1.0;
},
appRunner: () => runApp(MyApp()),
);
Expand Down Expand Up @@ -198,7 +198,7 @@ SentryNavigatorObserver(ignoreRoutes: ["/ignoreThisRoute"]),
(options) {
...
options.experimental.replay.sessionSampleRate = 1.0;
options.experimental.replay.errorSampleRate = 1.0;
options.experimental.replay.onErrorSampleRate = 1.0;
},
appRunner: () => runApp(MyApp()),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class SentryFlutter(
data: Map<String, Any>,
) {
options.sessionSampleRate = data["sessionSampleRate"] as? Double
options.errorSampleRate = data["errorSampleRate"] as? Double
options.errorSampleRate = data["onErrorSampleRate"] as? Double
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Fixture {
"replay" to
mapOf(
"sessionSampleRate" to 0.5,
"errorSampleRate" to 0.6,
"onErrorSampleRate" to 0.6,
),
)

Expand Down
2 changes: 1 addition & 1 deletion flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Future<void> setupSentry(
options.navigatorKey = navigatorKey;

options.experimental.replay.sessionSampleRate = 1.0;
options.experimental.replay.errorSampleRate = 1.0;
options.experimental.replay.onErrorSampleRate = 1.0;

_isIntegrationTest = isIntegrationTest;
if (_isIntegrationTest) {
Expand Down
2 changes: 1 addition & 1 deletion flutter/ios/Classes/SentryFlutter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public final class SentryFlutter {
options.experimental.sessionReplay.sessionSampleRate =
(replayOptions["sessionSampleRate"] as? NSNumber)?.floatValue ?? 0
options.experimental.sessionReplay.onErrorSampleRate =
(replayOptions["errorSampleRate"] as? NSNumber)?.floatValue ?? 0
(replayOptions["onErrorSampleRate"] as? NSNumber)?.floatValue ?? 0
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/native/cocoa/sentry_native_cocoa.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SentryNativeCocoa extends SentryNativeChannel {
if (options.experimental.replay.isEnabled &&
options.platformChecker.platform.isIOS) {
// We only need the integration when error-replay capture is enabled.
if ((options.experimental.replay.errorSampleRate ?? 0) > 0) {
if ((options.experimental.replay.onErrorSampleRate ?? 0) > 0) {
options.addEventProcessor(ReplayEventProcessor(this));
}

Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/native/java/sentry_native_java.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SentryNativeJava extends SentryNativeChannel {
// so let's set it up conditionally. This allows Dart to trim the code.
if (options.experimental.replay.isEnabled) {
// We only need the integration when error-replay capture is enabled.
if ((options.experimental.replay.errorSampleRate ?? 0) > 0) {
if ((options.experimental.replay.onErrorSampleRate ?? 0) > 0) {
options.addEventProcessor(ReplayEventProcessor(this));
}

Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/src/native/sentry_native_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SentryNativeChannel
if (options.proxy != null) 'proxy': options.proxy?.toJson(),
'replay': <String, dynamic>{
'sessionSampleRate': options.experimental.replay.sessionSampleRate,
'errorSampleRate': options.experimental.replay.errorSampleRate,
'onErrorSampleRate': options.experimental.replay.onErrorSampleRate,
},
});
}
Expand Down
10 changes: 5 additions & 5 deletions flutter/lib/src/sentry_replay_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class SentryReplayOptions {
_sessionSampleRate = value;
}

double? _errorSampleRate;
double? _onErrorSampleRate;

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

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

@internal
bool get isEnabled =>
((sessionSampleRate ?? 0) > 0) || ((errorSampleRate ?? 0) > 0);
((sessionSampleRate ?? 0) > 0) || ((onErrorSampleRate ?? 0) > 0);
}
6 changes: 3 additions & 3 deletions flutter/test/integrations/init_native_sdk_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void main() {
'appHangTimeoutIntervalMillis': 2000,
'replay': <String, dynamic>{
'sessionSampleRate': null,
'errorSampleRate': null,
'onErrorSampleRate': null,
},
});
});
Expand Down Expand Up @@ -118,7 +118,7 @@ void main() {
pass: '0000',
)
..experimental.replay.sessionSampleRate = 0.1
..experimental.replay.errorSampleRate = 0.2;
..experimental.replay.onErrorSampleRate = 0.2;

fixture.options.sdk.addIntegration('foo');
fixture.options.sdk.addPackage('bar', '1');
Expand Down Expand Up @@ -172,7 +172,7 @@ void main() {
},
'replay': <String, dynamic>{
'sessionSampleRate': 0.1,
'errorSampleRate': 0.2,
'onErrorSampleRate': 0.2,
},
});
});
Expand Down
4 changes: 2 additions & 2 deletions flutter/test/replay/replay_native_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void main() {

test('init sets $ReplayEventProcessor when error replay is enabled',
() async {
options.experimental.replay.errorSampleRate = 0.1;
options.experimental.replay.onErrorSampleRate = 0.1;
await sut.init(hub);

expect(options.eventProcessors.map((e) => e.runtimeType.toString()),
Expand All @@ -95,7 +95,7 @@ void main() {
group('replay recorder', () {
setUp(() async {
options.experimental.replay.sessionSampleRate = 0.1;
options.experimental.replay.errorSampleRate = 0.1;
options.experimental.replay.onErrorSampleRate = 0.1;
await sut.init(hub);
});

Expand Down

0 comments on commit f1e03bb

Please sign in to comment.