Module: OpenTelemetry::Instrumentation::Resque::Patches::ResqueModule::ClassMethods
- Defined in:
- lib/opentelemetry/instrumentation/resque/patches/resque_module.rb
Overview
Module to prepend to Resque singleton class
Instance Method Summary collapse
Instance Method Details
#config ⇒ Object
52 53 54 |
# File 'lib/opentelemetry/instrumentation/resque/patches/resque_module.rb', line 52 def config Resque::Instrumentation.instance.config end |
#push(queue, item) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/opentelemetry/instrumentation/resque/patches/resque_module.rb', line 21 def push(queue, item) # Check if the job is being wrapped by ActiveJob # before retrieving the job class name job_class = if item[:class] == 'ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper' && item[:args][0]&.is_a?(Hash) item[:args][0]['job_class'] else item[:class] end attributes = { 'messaging.system' => 'resque', 'messaging.destination' => queue.to_s, 'messaging.destination_kind' => 'queue', 'messaging.resque.job_class' => job_class } span_name = case config[:span_naming] when :job_class then "#{job_class} send" else "#{queue} send" end tracer.in_span(span_name, attributes: attributes, kind: :producer) do OpenTelemetry.propagation.inject(item) super end end |
#tracer ⇒ Object
48 49 50 |
# File 'lib/opentelemetry/instrumentation/resque/patches/resque_module.rb', line 48 def tracer Resque::Instrumentation.instance.tracer end |