81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/oboe/inst/resque.rb', line 81
def perform_with_oboe(job)
report_kvs = {}
last_arg = nil
begin
report_kvs[:Op] = :perform
report_kvs[:Controller] = :Resque
report_kvs[:Action] = :perform
report_kvs['HTTP-Host'] = Socket.gethostname
report_kvs[:URL] = '/resque/' + job.queue
report_kvs[:Method] = 'NONE'
report_kvs[:Queue] = job.queue
report_kvs[:Class] = job.payload['class']
if Oboe::Config[:resque][:log_args]
kv_args = job.payload['args'].to_json
if kv_args.length > 1024
report_kvs[:Args] = kv_args[0..1023] + '...[snipped]'
else
report_kvs[:Args] = kv_args
end
end
last_arg = job.payload['args'].last
rescue
end
if last_arg.is_a?(Hash) and last_arg.has_key?('parent_trace_id')
begin
report_kvs[:ParentTraceID] = last_arg['parent_trace_id']
job.payload['args'].pop
rescue
end
Oboe::API.start_trace('resque-worker', nil, report_kvs.merge('Force' => true)) do
perform_without_oboe(job)
end
else
Oboe::API.start_trace('resque-worker', nil, report_kvs) do
perform_without_oboe(job)
end
end
end
|