Class: ElasticAPM::Spies::ShoryukenSpy::Middleware Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/spies/shoryuken.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_instance, queue, sqs_msg, body) ⇒ 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.



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

def call(worker_instance, queue, sqs_msg, body)
  transaction =
    ElasticAPM.start_transaction(
      job_class(worker_instance, body),
      'shoryuken.job'
    )

  ElasticAPM.set_label('shoryuken.id', sqs_msg.message_id)
  ElasticAPM.set_label('shoryuken.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