Module: Oboe::Inst::Resque
- Defined in:
- lib/oboe/inst/resque.rb
Class Method Summary collapse
Instance Method Summary collapse
- #dequeue_with_oboe(klass, *args) ⇒ Object
- #enqueue_to_with_oboe(queue, klass, *args) ⇒ Object
- #enqueue_with_oboe(klass, *args) ⇒ Object
- #extract_trace_details(op, klass, args) ⇒ Object
Class Method Details
.included(base) ⇒ Object
11 12 13 |
# File 'lib/oboe/inst/resque.rb', line 11 def self.included(base) base.send :extend, ::Resque end |
Instance Method Details
#dequeue_with_oboe(klass, *args) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/oboe/inst/resque.rb', line 67 def dequeue_with_oboe(klass, *args) if Oboe.tracing? report_kvs = extract_trace_details(:dequeue, klass, args) Oboe::API.trace('resque-client', report_kvs) do dequeue_without_oboe(klass, *args) end else dequeue_without_oboe(klass, *args) end end |
#enqueue_to_with_oboe(queue, klass, *args) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/oboe/inst/resque.rb', line 53 def enqueue_to_with_oboe(queue, klass, *args) if Oboe.tracing? and not Oboe::Context.tracing_layer_op?(:enqueue) report_kvs = extract_trace_details(:enqueue_to, klass, args) report_kvs[:Queue] = queue.to_s if queue Oboe::API.trace('resque-client', report_kvs) do args.push({:parent_trace_id => Oboe::Context.toString}) if Oboe::Config[:resque][:link_workers] enqueue_to_without_oboe(queue, klass, *args) end else enqueue_to_without_oboe(queue, klass, *args) end end |
#enqueue_with_oboe(klass, *args) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/oboe/inst/resque.rb', line 40 def enqueue_with_oboe(klass, *args) if Oboe.tracing? report_kvs = extract_trace_details(:enqueue, klass, args) Oboe::API.trace('resque-client', report_kvs, :enqueue) do args.push({:parent_trace_id => Oboe::Context.toString}) if Oboe::Config[:resque][:link_workers] enqueue_without_oboe(klass, *args) end else enqueue_without_oboe(klass, *args) end end |
#extract_trace_details(op, klass, args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/oboe/inst/resque.rb', line 15 def extract_trace_details(op, klass, args) report_kvs = {} begin report_kvs[:Op] = op.to_s report_kvs[:Class] = klass.to_s if klass if Oboe::Config[:resque][:log_args] kv_args = args.to_json # Limit the argument json string to 1024 bytes if kv_args.length > 1024 report_kvs[:Args] = kv_args[0..1023] + '...[snipped]' else report_kvs[:Args] = kv_args end end report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:resque][:collect_backtraces] rescue end report_kvs end |