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

Cron CheckIn events are affected by sample_rate #2202

Closed
flood4life opened this issue Dec 18, 2023 · 1 comment · Fixed by #2203
Closed

Cron CheckIn events are affected by sample_rate #2202

flood4life opened this issue Dec 18, 2023 · 1 comment · Fixed by #2203
Assignees

Comments

@flood4life
Copy link

Issue Description

We are trialling the Cron Monitoring beta (which looks like a very promising product!), and have noticed a strangely erratic nature of our cron check ins: Sentry often reported them as timed out or missing when according to our data the scheduled workers ran on time and in reasonable time.

We also have set the sample_rate config option to 0.25 to report fewer exceptions to Sentry.

I followed the source code for capturing the CheckIn events and discovered that they are affected by the sample_rate parameter: https://github.com/getsentry/sentry-ruby/blob/master/sentry-ruby/lib/sentry/client.rb#L51-L54

It appears that TransactionEvent is the only type of Event that is not affected by sample_rate, and is using its own dedicated config for sampling. I feel like the simplest solution here could be extending this check to ignore CheckInEvents as well. However, sample_rate affecting events other than errors was a bit surprising for us as well, so perhaps the docs could be improved to reflect this gotcha?

If you agree with my proposed solution, I'm happy to take a stab at submitting a patch.

As a workaround for now, we have removed the sample_rate config option and instead applied the same logic in before_send, but only for Exception events.

Reproduction Steps

Configure sample_rate to be below 1, instrument a worker with cron monitoring, and perform it a bunch of times

Expected Behavior

All CheckIn events reach Sentry

Actual Behavior

CheckIn events are sampled

Ruby Version

3.2.2

SDK Version

5.15.1

Integration and Its Version

No response

Sentry Config

Sentry.init do |config|
  config.sample_rate = 0.25
  config.enabled_patches += [:sidekiq_scheduler]
end
@sl0thentr0py
Copy link
Member

@flood4life oops you're right, ty for reporting this! I did miss this case because I don't test with sample_rate for errors usually. Will fix it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants