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
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sentry-ruby/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Individual gem's changelog has been deprecated. Please check the [project changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md).

## Unreleased

- Improve the accuracy of duration calculations in cron jobs monitoring ([#2471](https://github.com/getsentry/sentry-ruby/pull/2471))

## 4.4.2

- Fix NoMethodError when SDK's dsn is nil [#1433](https://github.com/getsentry/sentry-ruby/pull/1433)
Expand Down
6 changes: 3 additions & 3 deletions sentry-ruby/lib/sentry/cron/monitor_check_ins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
:in_progress,
monitor_config: monitor_config)

start = Sentry.utc_now.to_i
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)

Check warning on line 17 in sentry-ruby/lib/sentry/cron/monitor_check_ins.rb

View check run for this annotation

Codecov / codecov/patch

sentry-ruby/lib/sentry/cron/monitor_check_ins.rb#L17

Added line #L17 was not covered by tests

begin
# need to do this on ruby <= 2.6 sadly
ret = method(:perform).super_method.arity == 0 ? super() : super
duration = Sentry.utc_now.to_i - start
duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start

Check warning on line 22 in sentry-ruby/lib/sentry/cron/monitor_check_ins.rb

View check run for this annotation

Codecov / codecov/patch

sentry-ruby/lib/sentry/cron/monitor_check_ins.rb#L22

Added line #L22 was not covered by tests

Sentry.capture_check_in(slug,
:ok,
Expand All @@ -29,7 +29,7 @@

ret
rescue Exception
duration = Sentry.utc_now.to_i - start
duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start

Check warning on line 32 in sentry-ruby/lib/sentry/cron/monitor_check_ins.rb

View check run for this annotation

Codecov / codecov/patch

sentry-ruby/lib/sentry/cron/monitor_check_ins.rb#L32

Added line #L32 was not covered by tests

Sentry.capture_check_in(slug,
:error,
Expand Down
Loading