Class: ScoutApm::BackgroundJobIntegrations::SolidQueue
- Inherits:
-
Object
- Object
- ScoutApm::BackgroundJobIntegrations::SolidQueue
- Defined in:
- lib/scout_apm/background_job_integrations/solid_queue.rb
Constant Summary collapse
- UNKNOWN_QUEUE_PLACEHOLDER =
'default'.freeze
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/scout_apm/background_job_integrations/solid_queue.rb', line 5 def logger @logger end |
Instance Method Details
#forking? ⇒ Boolean
15 16 17 |
# File 'lib/scout_apm/background_job_integrations/solid_queue.rb', line 15 def forking? false end |
#install ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/scout_apm/background_job_integrations/solid_queue.rb', line 19 def install ActiveSupport.on_load(:active_job) do include ScoutApm::Tracer around_perform do |job, block| req = ScoutApm::RequestManager.lookup latency = Time.now - (job.scheduled_at || job.enqueued_at) rescue 0 req.annotate_request(queue_latency: latency) begin req.start_layer ScoutApm::Layer.new("Queue", job.queue_name.presence || UNKNOWN_QUEUE_PLACEHOLDER) started_queue = true # Following Convention req.start_layer ScoutApm::Layer.new("Job", job.class.name) started_job = true # Following Convention block.call rescue req.error! raise ensure req.stop_layer if started_job req.stop_layer if started_queue end end end end |
#name ⇒ Object
7 8 9 |
# File 'lib/scout_apm/background_job_integrations/solid_queue.rb', line 7 def name :solid_queue end |
#present? ⇒ Boolean
11 12 13 |
# File 'lib/scout_apm/background_job_integrations/solid_queue.rb', line 11 def present? defined?(::SolidQueue::VERSION) end |