Repository navigation
Pass the event sample rate to sentry-cocoa - #2940
Merged
Merged
Conversation
Native iOS and macOS crashes now follow SampleRate with both runtime and build-time initialization.
Drops the setter seam and its runtime tests; Init sets sampleRate the way Android and Native set theirs.
…e' into snek/sentry-unity-ios-sample-rate
bitsandfoxes
requested review from
a team,
jpnurmi,
limbonaut and
tustanivsky
November 11, 2026 13:40
jpnurmi
approved these changes
Nov 11, 2026
JoshuaMoelans
approved these changes
Nov 11, 2026
limbonaut
approved these changes
Nov 11, 2026
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native iOS and macOS crashes now follow the Event Sample Rate (
SampleRate).Unity passes the sample rate to the Android SDK and to sentry-native, but not to sentry-cocoa. sentry-cocoa applies its own
sampleRateto every error event, crashes included, and defaults to 1. So with the C# rate at 0.1, managed errors were sampled while native iOS and macOS crashes were always sent.The rate now reaches sentry-cocoa on both init paths, only when it is set, as on Android and Native (a rate of 1.0 leaves it out, and sentry-cocoa keeps its default):
SentryCocoaBridgeProxy.Init): this is the iOS default and the path macOS uses. It setssampleRatein the options dictionary through the existingOptionsSetDouble.NativeOptions): writes@"sampleRate"into the options generated into the Xcode project, formatted with the invariant culture.Tests:
CreateOptionsFile_SampleRateSet_WritesSampleRateandCreateOptionsFile_SampleRateSetUnderCommaDecimalCulture_WritesInvariantSampleRatefail without the fix;CreateOptionsFile_SampleRateNotSet_LeavesSampleRateOutcovers leaving the key out. The runtime path calls the native bridge directly and, like the other native bridges' option setup, has no unit test.🤖 Generated with Claude Code