Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: add-sample-rate-native #2200

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ class SentryFlutter(
data.getIfNotNull<Int>("readTimeoutMillis") {
options.readTimeoutMillis = it
}
data.getIfNotNull<Double>("sampleRate") {
options.sampleRate = it
}
}
}

Expand All @@ -128,7 +131,5 @@ private fun <T> Map<String, Any>.getIfNotNull(
key: String,
callback: (T) -> Unit,
) {
(get(key) as? T)?.let {
callback(it)
}
(get(key) as? T)?.let(callback)
}
3 changes: 3 additions & 0 deletions flutter/ios/Classes/SentryFlutter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public final class SentryFlutter {
if let appHangTimeoutIntervalMillis = data["appHangTimeoutIntervalMillis"] as? NSNumber {
options.appHangTimeoutInterval = appHangTimeoutIntervalMillis.doubleValue / 1000
}
if let sampleRate = data["sampleRate"] as? NSNumber? {
options.sampleRate = sampleRate
}
}

private func logLevelFrom(diagnosticLevel: String) -> SentryLevel {
Expand Down
2 changes: 2 additions & 0 deletions flutter/lib/src/native/sentry_native_channel.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';

// backcompatibility for Flutter < 3.3
// ignore: unnecessary_import
import 'dart:typed_data';
Expand Down Expand Up @@ -66,6 +67,7 @@ class SentryNativeChannel
'readTimeoutMillis': options.readTimeout.inMilliseconds,
'appHangTimeoutIntervalMillis':
options.appHangTimeoutInterval.inMilliseconds,
'sampleRate': options.sampleRate
});
}

Expand Down
Loading