Module: RailsSemanticLogging::JobLogging::ActiveJobPatch
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rails_semantic_logging/job_logging/active_job_patch.rb
Overview
ActiveJob patch to provide named tags instead of array tags. Converts the default tag_logger(class, id) call into named tags (job_class, job_id, queue, provider_job_id, executions) for structured logging.
provider_job_id is the queue backend's native id (e.g. the
solid_queue_jobs row id, or the Sidekiq jid) and lets a log line be
correlated with the job in Mission Control / the solid_queue_* tables.
It is only present once the job has been enqueued, so it is added
conditionally. executions is the ActiveJob attempt counter, which
makes retries visible in the logs.
Instance Method Summary collapse
Instance Method Details
#tag_logger(job_class = nil, job_id = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/rails_semantic_logging/job_logging/active_job_patch.rb', line 19 def tag_logger(job_class = nil, job_id = nil, &) if job_class && job_id = { job_class: job_class, job_id: job_id, queue: queue_name, executions: executions } [:provider_job_id] = provider_job_id if provider_job_id super(**, &) else super(&) end end |