Class: ElasticAPM::Spies::SidekiqSpy::Middleware Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/spies/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.

Instance Method Summary collapse

Instance Method Details

#call(_worker, job, queue) ⇒ 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.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/elastic_apm/spies/sidekiq.rb', line 30

def call(_worker, job, queue)
  name = SidekiqSpy.name_for(job)
  transaction = ElasticAPM.start_transaction(name, 'Sidekiq')
  ElasticAPM.set_label(:queue, queue)

  yield

  transaction&.done :success
  transaction&.outcome = Transaction::Outcome::SUCCESS
rescue ::Exception => e
  ElasticAPM.report(e, handled: false)
  transaction&.done :error
  transaction&.outcome = Transaction::Outcome::FAILURE
  raise
ensure
  ElasticAPM.end_transaction
end