Sha256: 8cb5fc254b768d10607043009b182d8c7650b4a7f88f201117def5591d34c3fe
Contents?: true
Size: 1.65 KB
Versions: 4
Compression:
Stored size: 1.65 KB
Contents
module Sentry module Cron module MonitorCheckIns module Patch def perform(*args) slug = self.class.sentry_monitor_slug || self.class.name monitor_config = self.class.sentry_monitor_config check_in_id = Sentry.capture_check_in(slug, :in_progress, monitor_config: monitor_config) start = Sentry.utc_now.to_i ret = super duration = Sentry.utc_now.to_i - start Sentry.capture_check_in(slug, :ok, check_in_id: check_in_id, duration: duration, monitor_config: monitor_config) ret rescue Exception duration = Sentry.utc_now.to_i - start Sentry.capture_check_in(slug, :error, check_in_id: check_in_id, duration: duration, monitor_config: monitor_config) raise end end module ClassMethods def sentry_monitor_check_ins(slug: nil, monitor_config: nil) @sentry_monitor_slug = slug @sentry_monitor_config = monitor_config prepend Patch end def sentry_monitor_slug @sentry_monitor_slug end def sentry_monitor_config @sentry_monitor_config end end extend ClassMethods def self.included(base) base.extend(ClassMethods) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems