170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/epsagon.rb', line 170
def call(_worker_class, job, _queue, _redis_pool)
config = OpenTelemetry::Instrumentation::Sidekiq::Instrumentation.instance.config[:epsagon] || {}
attributes = {
'operation' => job['at'] ? 'perform_at' : 'perform_async',
'messaging.system' => 'sidekiq',
'messaging.sidekiq.job_class' => job['wrapped']&.to_s || job['class'],
'messaging.message_id' => job['jid'],
'messaging.destination' => job['queue'],
'messaging.destination_kind' => 'queue',
'messaging.sidekiq.redis_url' => Sidekiq.options['url'] || Util.redis_default_url
}
unless config[:metadata_only]
attributes.merge!({
'messaging.sidekiq.args' => JSON.dump(job['args'])
})
end
tracer.in_span(
job['queue'],
attributes: attributes,
kind: :producer
) do |span|
OpenTelemetry.propagation.text.inject(job)
span.add_event('created_at', timestamp: job['created_at'])
Util.untraced {yield}
end
end
|