Issue Description
I believe that the MonotonicActiveSupportLogger is not submitting correct data to Sentry::Breadcrumb. We saw breadcrumb dates hovering around 1970 when we enabled this; switching to ActiveSupportLogger fixed the issue.
The reason for this is that I believe ActiveSupport::Notifications.monotonic_subscribe uses Process.clock_gettime(Process::CLOCK_MONOTONIC). The values from this call are floats that don't correspond to Unix epoch timestamps, which I believe is what Sentry::Breadcrumb expects.
ActiveSupport code in question: https://github.com/rails/rails/blob/v7.0.3.1/activesupport/lib/active_support/notifications/fanout.rb#L240-L255
MonotonicActiveSupportLogger calls .to_i on the timestamp:
Reproduction Steps
- Enable
monotonic_active_support_logger in config.breadcrumbs_logger for Sentry initialization.
- Submit some data
- Inspect breadcrumb timestamps in Sentry
Expected Behavior
The timestamps are correct.
Actual Behavior
The timestamps are shown as early in the year 1970.
Ruby Version
3.1.2
SDK Version
5.4.2
Integration and Its Version
No response
Sentry Config
No response
Issue Description
I believe that the
MonotonicActiveSupportLoggeris not submitting correct data toSentry::Breadcrumb. We saw breadcrumb dates hovering around 1970 when we enabled this; switching toActiveSupportLoggerfixed the issue.The reason for this is that I believe
ActiveSupport::Notifications.monotonic_subscribeusesProcess.clock_gettime(Process::CLOCK_MONOTONIC). The values from this call are floats that don't correspond to Unix epoch timestamps, which I believe is what Sentry::Breadcrumb expects.ActiveSupport code in question: https://github.com/rails/rails/blob/v7.0.3.1/activesupport/lib/active_support/notifications/fanout.rb#L240-L255
MonotonicActiveSupportLoggercalls.to_ion the timestamp:sentry-ruby/sentry-rails/lib/sentry/rails/breadcrumb/monotonic_active_support_logger.rb
Line 23 in 71da673
Reproduction Steps
monotonic_active_support_loggerinconfig.breadcrumbs_loggerfor Sentry initialization.Expected Behavior
The timestamps are correct.
Actual Behavior
The timestamps are shown as early in the year 1970.
Ruby Version
3.1.2
SDK Version
5.4.2
Integration and Its Version
No response
Sentry Config
No response