Class: Salopulse::Instrumentation::SidekiqClientMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/salopulse/instrumentation/sidekiq_client_middleware.rb

Constant Summary collapse

PARENT_REQUEST_ID_KEY =
"salopulse_parent_request_id".freeze

Instance Method Summary collapse

Instance Method Details

#call(_worker_class, job, _queue, _redis_pool) ⇒ Object



8
9
10
11
12
# File 'lib/salopulse/instrumentation/sidekiq_client_middleware.rb', line 8

def call(_worker_class, job, _queue, _redis_pool)
  ctx = Salopulse::RequestContext.current
  job[PARENT_REQUEST_ID_KEY] = ctx[:request_id] if ctx && !job.key?(PARENT_REQUEST_ID_KEY)
  yield
end