7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/sidekiq_stats_instrumentation/server_middleware.rb', line 7
def call(worker, job, _queue, &)
queue_name = worker.class.get_sidekiq_options['queue']
worker_name = worker.class.name.gsub('::', '_')
StatsD.increment "shared.sidekiq.#{queue_name}.#{worker_name}.dequeue"
source = job['source']
RequestStore.store['additional_request_attributes'] ||= { 'source' => source } if source
StatsD.measure("shared.sidekiq.#{queue_name}.#{worker_name}.runtime", &)
rescue => e
StatsD.increment("shared.sidekiq.#{queue_name}.#{worker_name}.error")
raise e
ensure
::RequestStore.clear!
end
|