lib/elastic_apm/spies/sidekiq.rb in elastic-apm-1.1.0 vs lib/elastic_apm/spies/sidekiq.rb in elastic-apm-2.0.0
- old
+ new
@@ -4,28 +4,28 @@
# @api private
module Spies
# @api private
class SidekiqSpy
ACTIVE_JOB_WRAPPER =
- 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper'.freeze
+ 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper'
# @api private
class Middleware
# rubocop:disable Metrics/MethodLength
def call(_worker, job, queue)
name = SidekiqSpy.name_for(job)
- transaction = ElasticAPM.transaction(name, 'Sidekiq')
+ transaction = ElasticAPM.start_transaction(name, 'Sidekiq')
ElasticAPM.set_tag(:queue, queue)
yield
- transaction.submit('success') if transaction
+ transaction.done :success if transaction
rescue ::Exception => e
ElasticAPM.report(e, handled: false)
- transaction.submit(:error) if transaction
+ transaction.done :error if transaction
raise
ensure
- transaction.release if transaction
+ ElasticAPM.end_transaction
end
# rubocop:enable Metrics/MethodLength
end
def self.name_for(job)