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

Improve the accuracy of duration calculations in cron jobs monitoring #2471

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

krzysztofjablonski
Copy link

@krzysztofjablonski krzysztofjablonski commented Nov 22, 2024

This pull request includes changes to the perform method in the sentry-ruby/lib/sentry/cron/monitor_check_ins.rb file to improve the accuracy of duration calculations.

  • Changed the duration calculation to use floating-point precision instead of integer precision to improve accuracy. [1] [2]

Before:

image

After:

image

Copy link
Collaborator

@solnic solnic left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! Actually, we should probably consider adding a helper for the duration and use the approach described here: https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/

This should give the best results.

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.17%. Comparing base (a9b3687) to head (8825281).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2471   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files         128      128           
  Lines        4825     4829    +4     
=======================================
+ Hits         4737     4741    +4     
  Misses         88       88           
Components Coverage Δ
sentry-ruby 98.57% <100.00%> (+<0.01%) ⬆️
sentry-rails 97.08% <ø> (ø)
sentry-sidekiq 96.96% <ø> (ø)
sentry-resque 92.85% <ø> (ø)
sentry-delayed_job 95.65% <ø> (ø)
sentry-opentelemetry 99.31% <ø> (ø)
Files with missing lines Coverage Δ
sentry-ruby/lib/sentry/cron/monitor_check_ins.rb 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

Successfully merging this pull request may close these issues.

3 participants