Class: Appsignal::Integrations::SidekiqMiddleware Private
- Includes:
- Hooks::Helpers
- Defined in:
- lib/appsignal/integrations/sidekiq.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- EXCLUDED_JOB_KEYS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[ args backtrace class created_at enqueued_at error_backtrace error_class error_message failed_at jid retried_at retry wrapped ].freeze
Instance Method Summary collapse
Methods included from Hooks::Helpers
Instance Method Details
#call(_worker, item, _queue, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/appsignal/integrations/sidekiq.rb', line 61 def call(_worker, item, _queue, &block) job_status = nil transaction = Appsignal::Transaction.create(Appsignal::Transaction::BACKGROUND_JOB) transaction.set_action_if_nil(formatted_action_name(item)) (item).each do |key, value| transaction. key, value end Appsignal.instrument "perform_job.sidekiq", &block rescue Exception => exception # rubocop:disable Lint/RescueException job_status = :failed raise exception ensure if transaction transaction.add_params_if_nil { parse_arguments(item) } queue_start = (item["enqueued_at"].to_f * 1000.0).to_i # Convert seconds to milliseconds transaction.set_queue_start(queue_start) transaction.(:request_id => item["jid"]) Appsignal::Transaction.complete_current! unless exception queue = item["queue"] || "unknown" if job_status increment_counter "queue_job_count", 1, :queue => queue, :status => job_status end increment_counter "queue_job_count", 1, :queue => queue, :status => :processed end end |