Module: Sentry::GoodJob::ActiveJobExtensions
- Defined in:
- lib/sentry/good_job/active_job_extensions.rb
Defined Under Namespace
Modules: GoodJobExtensions
Class Method Summary collapse
-
.enhance_sentry_context(job, base_context) ⇒ Object
Enhance sentry-rails ActiveJob context with GoodJob-specific data.
-
.enhance_sentry_tags(job, base_tags) ⇒ Object
Enhance sentry-rails ActiveJob tags with GoodJob-specific data.
-
.setup ⇒ Object
Set up GoodJob-specific ActiveJob extensions.
Class Method Details
.enhance_sentry_context(job, base_context) ⇒ Object
Enhance sentry-rails ActiveJob context with GoodJob-specific data
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sentry/good_job/active_job_extensions.rb', line 11 def self.enhance_sentry_context(job, base_context) return base_context unless job.respond_to?(:queue_name) && job.respond_to?(:executions) # Add GoodJob-specific context to the existing sentry-rails context good_job_context = { queue_name: job.queue_name, executions: job.executions, enqueued_at: job.enqueued_at, priority: job.respond_to?(:priority) ? job.priority : nil } # Merge with base context, preserving existing structure base_context.merge(good_job: good_job_context) end |
.enhance_sentry_tags(job, base_tags) ⇒ Object
Enhance sentry-rails ActiveJob tags with GoodJob-specific data
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sentry/good_job/active_job_extensions.rb', line 27 def self.(job, ) return unless job.respond_to?(:queue_name) && job.respond_to?(:executions) = { queue_name: job.queue_name, executions: job.executions } # Add priority if available if job.respond_to?(:priority) [:priority] = job.priority end .merge() end |
.setup ⇒ Object
Set up GoodJob-specific ActiveJob extensions
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/sentry/good_job/active_job_extensions.rb', line 44 def self.setup return unless defined?(::Rails) && ::Sentry.initialized? # Hook into sentry-rails ActiveJob integration if defined?(::Sentry::Rails::ActiveJobExtensions::SentryReporter) enhance_sentry_reporter end # Set up GoodJob-specific ActiveJob extensions setup_good_job_extensions end |