Class: Skylight::Probes::ActiveJob::EnqueueProbe Private
- Defined in:
- lib/skylight/probes/active_job_enqueue.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- CAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"other.active_job.enqueue".freeze
Instance Method Summary collapse
- #install ⇒ Object private
Instance Method Details
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/skylight/probes/active_job_enqueue.rb', line 7 def install ::ActiveJob::Base.around_enqueue do |job, block| job_class = job.class adapter_name = EnqueueProbe.normalize_adapter_name(job_class) # If this is an ActionMailer::DeliveryJob, we'll report this as the mailer title # and include ActionMailer::DeliveryJob in the description. name, job_class_name = Normalizers::ActiveJob::Perform.normalize_title(job) descriptors = ["adapter: '#{adapter_name}'", "queue: '#{job.queue_name}'"] descriptors << "job: '#{job_class_name}'" if job_class_name desc = "{ #{descriptors.join(", ")} }" rescue StandardError block.call else Skylight.instrument(title: "Enqueue #{name}", category: CAT, description: desc, internal: true, &block) end self.class.instance_eval do def normalize_adapter_name(job_class) job_class.queue_adapter_name end end end |