Class: Loggery::Metadata::Middleware::Sidekiq
- Inherits:
-
Object
- Object
- Loggery::Metadata::Middleware::Sidekiq
- Includes:
- Util
- Defined in:
- lib/loggery/metadata/middleware/sidekiq.rb
Class Attribute Summary collapse
-
.error_handler ⇒ Object
Returns the value of attribute error_handler.
Instance Method Summary collapse
Methods included from Util
Class Attribute Details
.error_handler ⇒ Object
Returns the value of attribute error_handler.
13 14 15 |
# File 'lib/loggery/metadata/middleware/sidekiq.rb', line 13 def error_handler @error_handler end |
Instance Method Details
#call(_worker, msg, queue) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/loggery/metadata/middleware/sidekiq.rb', line 16 def call(_worker, msg, queue) Loggery::Metadata::Store.(jid: msg["jid"], thread_id: Thread.current.object_id.to_s(36), worker: msg["class"], args: msg["args"].inspect, queue: queue, retry_count: msg["retry_count"], worker_type: "sidekiq") do log_job_runtime(:sidekiq_job, "#{msg['class']} (#{msg['args']})") do begin yield rescue StandardError => e # Log exceptions here, otherwise they won't have the metadata available anymore by # the time they reach the Sidekiq default error handler. self.class.error_handler&.call(e) raise e end end end end |