Sha256: cb2c2a24293112a34db530bb917b58530ff5212c7fa2d5afc6936a4f092acb44
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
module Sentry module Rails module ActiveJobExtensions def self.included(base) base.class_eval do around_perform do |job, block| if Sentry.initialized? if already_supported_by_specific_integration?(job) block.call else Sentry.with_scope do capture_and_reraise_with_sentry(job, block) end end else block.call end end end end def capture_and_reraise_with_sentry(job, block) block.call rescue Exception => e # rubocop:disable Lint/RescueException rescue_handler_result = rescue_with_handler(e) return rescue_handler_result if rescue_handler_result Sentry::Rails.capture_exception( e, extra: sentry_context(job), tags: { job_id: job.job_id, provider_job_id: job.provider_job_id } ) raise e end def already_supported_by_specific_integration?(job) Sentry.configuration.rails.skippable_job_adapters.include?(job.class.queue_adapter.class.to_s) end def sentry_context(job) { active_job: job.class.name, arguments: job.arguments, scheduled_at: job.scheduled_at, job_id: job.job_id, provider_job_id: job.provider_job_id, locale: job.locale } end end end end class ActiveJob::Base include Sentry::Rails::ActiveJobExtensions end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sentry-rails-4.2.2 | lib/sentry/rails/active_job.rb |
sentry-rails-4.2.1 | lib/sentry/rails/active_job.rb |
sentry-rails-4.2.0 | lib/sentry/rails/active_job.rb |