Sha256: c5f8478af2db5ff570ddf5aae550be3de332857ea1986e5a7d82f217926b33cf
Contents?: true
Size: 802 Bytes
Versions: 3
Compression:
Stored size: 802 Bytes
Contents
# frozen_string_literal: true 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) Trifle::Traces.tracer&.fail! raise e ensure Trifle::Traces.tracer&.wrapup end def tracer_for(job:) return nil unless job['tracer_key'] Trifle::Traces.default.tracer_class.new( key: job['tracer_key'], meta: job['args'] ) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trifle-traces-1.1.2 | lib/trifle/traces/middleware/sidekiq.rb |
trifle-traces-1.1.1 | lib/trifle/traces/middleware/sidekiq.rb |
trifle-traces-1.1.0 | lib/trifle/traces/middleware/sidekiq.rb |