From 88252819bf6b811e18c701f1011a09b4e2cb919c Mon Sep 17 00:00:00 2001 From: Krzysztof Jablonski Date: Fri, 22 Nov 2024 17:27:08 +0100 Subject: [PATCH 1/4] Update monitor_check_ins.rb --- sentry-ruby/lib/sentry/cron/monitor_check_ins.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb b/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb index 835ae84ad..559d2f81d 100644 --- a/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb +++ b/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb @@ -19,7 +19,7 @@ def perform(*args, **opts) 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 = Sentry.utc_now.to_f - start Sentry.capture_check_in(slug, :ok, @@ -29,7 +29,7 @@ def perform(*args, **opts) ret rescue Exception - duration = Sentry.utc_now.to_i - start + duration = Sentry.utc_now.to_f - start Sentry.capture_check_in(slug, :error, From d73c0fd3bcc885b9a85149da0a43afab40f6d94d Mon Sep 17 00:00:00 2001 From: Krzysztof Jablonski Date: Sun, 1 Dec 2024 12:22:34 +0100 Subject: [PATCH 2/4] Update monitor_check_ins.rb --- sentry-ruby/CHANGELOG.md | 4 ++++ sentry-ruby/lib/sentry/cron/monitor_check_ins.rb | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sentry-ruby/CHANGELOG.md b/sentry-ruby/CHANGELOG.md index 74a145f65..58a1fca38 100644 --- a/sentry-ruby/CHANGELOG.md +++ b/sentry-ruby/CHANGELOG.md @@ -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) diff --git a/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb b/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb index 559d2f81d..314733cfb 100644 --- a/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb +++ b/sentry-ruby/lib/sentry/cron/monitor_check_ins.rb @@ -14,12 +14,12 @@ def perform(*args, **opts) :in_progress, monitor_config: monitor_config) - start = Sentry.utc_now.to_i + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) begin # need to do this on ruby <= 2.6 sadly ret = method(:perform).super_method.arity == 0 ? super() : super - duration = Sentry.utc_now.to_f - start + duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start Sentry.capture_check_in(slug, :ok, @@ -29,7 +29,7 @@ def perform(*args, **opts) ret rescue Exception - duration = Sentry.utc_now.to_f - start + duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start Sentry.capture_check_in(slug, :error, From 98b323912b0dfc6f55e1929dceecfc49710d859e Mon Sep 17 00:00:00 2001 From: Krzysztof Jablonski Date: Wed, 18 Dec 2024 21:52:14 +0100 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49d11bda1..4e7bc0aed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Add support for string errors in error reporter ([#2464](https://github.com/getsentry/sentry-ruby/pull/2464)) - Reset trace_id and add root transaction for sidekiq-cron [#2446](https://github.com/getsentry/sentry-ruby/pull/2446) - Add support for Excon HTTP client instrumentation ([#2383](https://github.com/getsentry/sentry-ruby/pull/2383)) +- Improve the accuracy of duration calculations in cron jobs monitoring ([#2471](https://github.com/getsentry/sentry-ruby/pull/2471)) Note: MemoryStore and FileStore require Rails 8.0+ From 142b243c6d287a47ef7317072ad5fc2bba0fa83b Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Thu, 19 Dec 2024 08:16:44 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md --- sentry-ruby/CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sentry-ruby/CHANGELOG.md b/sentry-ruby/CHANGELOG.md index 58a1fca38..74a145f65 100644 --- a/sentry-ruby/CHANGELOG.md +++ b/sentry-ruby/CHANGELOG.md @@ -2,10 +2,6 @@ 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)