Sha256: 48b3f56ece91f9bb1fa5b9c2932abbda965cc588b6c417357c422e6afa487d30
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 Bytes
Contents
module Pliny::Sidekiq class JobLogger def call(job, queue) context = { sidekiq: true, job: job['class'], job_id: job['jid'], job_retry: job['retry'], } begin start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) log(context, job_logger: true, at: :start) yield log(context, job_logger: true, at: :finish, status: :done, duration: elapsed(start)) rescue Exception log(context, job_logger: true, at: :finish, status: :fail, duration: elapsed(start)) raise end end private def log(context, data = {}, &blk) Pliny.log(context.merge(data), &blk) end def elapsed(start) (::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start).round(3) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pliny-sidekiq-0.3.1 | lib/pliny/sidekiq/job_logger.rb |