Module: Sentry::GoodJob::ContextHelpers
- Defined in:
- lib/sentry/good_job/context_helpers.rb
Class Method Summary collapse
-
.add_context(job, base_context = {}) ⇒ Object
Add GoodJob-specific information to the existing Sentry Rails context.
-
.add_tags(job, base_tags = {}) ⇒ Object
Add GoodJob-specific information to the existing Sentry Rails tags.
Class Method Details
.add_context(job, base_context = {}) ⇒ Object
Add GoodJob-specific information to the existing Sentry Rails context
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sentry/good_job/context_helpers.rb', line 9 def self.add_context(job, base_context = {}) return base_context unless job.respond_to?(:queue_name) && job.respond_to?(:executions) good_job_context = { queue_name: job.queue_name, executions: job.executions, enqueued_at: job.enqueued_at, priority: job.respond_to?(:priority) ? job.priority : nil } # Note: Job arguments are handled by sentry-rails via send_default_pii configuration # This is controlled by Sentry.configuration.send_default_pii, not GoodJob-specific config # Merge with base context base_context.merge(good_job: good_job_context) end |
.add_tags(job, base_tags = {}) ⇒ Object
Add GoodJob-specific information to the existing Sentry Rails tags
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sentry/good_job/context_helpers.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 |