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

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

krzysztofjablonski
Copy link
Contributor

@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.19%. Comparing base (a9b3687) to head (142b243).
Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2471      +/-   ##
==========================================
+ Coverage   98.17%   98.19%   +0.02%     
==========================================
  Files         128      128              
  Lines        4825     4833       +8     
==========================================
+ Hits         4737     4746       +9     
+ Misses         88       87       -1     
Components Coverage Δ
sentry-ruby 98.57% <100.00%> (+<0.01%) ⬆️
sentry-rails 97.07% <ø> (-0.01%) ⬇️
sentry-sidekiq 97.42% <ø> (+0.45%) ⬆️
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 5 files with indirect coverage changes

@solnic solnic merged commit bb9ce72 into getsentry:master Dec 19, 2024
135 checks passed
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