Class: NewrelicGvl::Sidekiq::Middleware

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::ClientMiddleware
Defined in:
lib/newrelic_gvl/sidekiq/middleware.rb

Instance Method Summary collapse

Instance Method Details

#call(_worker, _job, _queue, _redis_pool) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/newrelic_gvl/sidekiq/middleware.rb', line 8

def call(_worker, _job, _queue, _redis_pool)
  before = GVLTools::LocalTimer.monotonic_time

  yield
ensure
  wait_in_ms = (GVLTools::LocalTimer.monotonic_time - before) / 1_000_000.0

  NewRelic::Agent.add_custom_attributes({gvl_wait: wait_in_ms})
end