Skip to content

Allow consumers to specify sample rate#217

Merged
wzieba merged 3 commits intotrunkfrom
allow_users_to_provide_sample_rate
May 3, 2024
Merged

Allow consumers to specify sample rate#217
wzieba merged 3 commits intotrunkfrom
allow_users_to_provide_sample_rate

Conversation

@wzieba
Copy link
Copy Markdown
Member

@wzieba wzieba commented May 2, 2024

Description

This PR introduces a new property to configure for consumers: errorSampling which allows them to reduce the number of issues they report.

Testing

It's not necessarily - the property is passed (unit tests) and we don't aim to test Sentry framework here - we trust it simply works.

@wzieba wzieba marked this pull request as ready for review May 2, 2024 12:33
@wzieba wzieba requested a review from iangmaia May 2, 2024 12:33
@wzieba
Copy link
Copy Markdown
Member Author

wzieba commented May 2, 2024

hi @iangmaia 👋 are you fine with reviewing this PR? 🙂

event
}
sampleRate = when (val errorsSampleRate = dataProvider.errorSampling) {
ErrorSampling.Disabled -> null
Copy link
Copy Markdown
Contributor

@iangmaia iangmaia May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null here confused me a bit, but looking at the code it's clear that this is a sort of mapping between the exposed ErrorSampling and this internal options from Sentry, I guess?
No change required, I just want to confirm my understanding 🙂 (but maybe worth a comment if it's not that obvious)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null here confused me a bit, but looking at the code it's clear that this is a sort of mapping between the exposed ErrorSampling and this internal options from Sentry, I guess?

Yes, exactly! Looking at source code of Sentry, options.sampleRate is null by default and null means "we don't sample errors".

Alternatively, null is the same as we would set sampleRate = 1.0 (meaning: all errors are sent), but null is a default expected by framework to disable this feature, so that's why I decided to map like this.

@wzieba wzieba merged commit 3b12e8d into trunk May 3, 2024
@wzieba wzieba deleted the allow_users_to_provide_sample_rate branch May 3, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants