lib/trifle/traces/middleware/sidekiq.rb in trifle-traces-1.0.1 vs lib/trifle/traces/middleware/sidekiq.rb in trifle-traces-1.1.0
- old
+ new
@@ -2,9 +2,11 @@
module Trifle
module Traces
module Middleware
class Sidekiq
+ include ::Sidekiq::ServerMiddleware if const_defined?('::Sidekiq::ServerMiddleware')
+
def call(_worker, job, _queue)
Trifle::Traces.tracer = tracer_for(job: job)
yield
rescue => e # rubocop:disable Style/RescueStandardError
Trifle::Traces.tracer&.trace("Exception: #{e}", state: :error)