Class: SidekiqUtils::Middleware::Server::ThroughputMonitor
- Inherits:
-
Object
- Object
- SidekiqUtils::Middleware::Server::ThroughputMonitor
- Defined in:
- lib/sidekiq_utils/middleware/server/throughput_monitor.rb
Instance Method Summary collapse
Instance Method Details
#call(worker, job, queue) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sidekiq_utils/middleware/server/throughput_monitor.rb', line 5 def call(worker, job, queue) start = Time.now begin yield ensure elapsed = Time.now - start elapsed_ms = (elapsed * 1_000).round SidekiqUtils::RedisMonitorStorage.store( 'sidekiq_elapsed', 'elapsed', job, elapsed_ms) Sidekiq.redis do |redis| redis.hset('sidekiq_last_run', SidekiqUtils::RedisMonitorStorage.job_prefix(job), Time.now.to_i) end end end |