Sha256: 25e16271cb49b0a3a4c05d5d04c906cc2432e33e15c8e81a1d6858acc80426b9
Contents?: true
Size: 875 Bytes
Versions: 1
Compression:
Stored size: 875 Bytes
Contents
require_relative 'base' require_relative '../trace' module RequestTracer module Integration module SidekiqHandler include Base extend self def activate require 'sidekiq' Sidekiq.configure_server do |config| config.server_middleware do |chain| chain.add ServerMiddleware end end Sidekiq.configure_client do |config| config.client_middleware do |chain| chain.add ClientMiddleware end end end class ServerMiddleware def call(worker, msg, queue) Trace.push(msg["trace"]) do |trace| yield end end end class ClientMiddleware def call(worker_class, job, queue, redis_pool) job['trace'] = Trace.latest.to_h yield end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
request-tracer-0.6.1 | lib/request_tracer/integration/sidekiq_handler.rb |