lib/dispatch-rider/integrations/appsignal.rb in dispatch-rider-1.8.3 vs lib/dispatch-rider/integrations/appsignal.rb in dispatch-rider-1.8.4
- old
+ new
@@ -4,35 +4,24 @@
module DispatchRider
module Integrations
module Appsignal
def self.wrap_message(job, message)
- begin
- ::Appsignal::Transaction.create(
- SecureRandom.uuid,
- ::Appsignal::Transaction::BACKGROUND_JOB,
- ::Appsignal::Transaction::GenericRequest.new(ENV.to_hash)
- )
+ ::Appsignal.start
- ::ActiveSupport::Notifications.instrument(
- 'perform_job.dispatch-rider',
- :class => message.subject,
- :method => 'handle',
- :attempts => message.receive_count,
- :queue => message.queue_name,
- :queue_time => (Time.now.to_f - message.sent_at.to_f) * 1000
- ) do
- job.call
- end
- rescue Exception => exception
- unless ::Appsignal.is_ignored_error?(exception)
- ::Appsignal::Transaction.current.add_exception(exception)
- end
- raise exception
- ensure
- ::Appsignal::Transaction.complete_current!
+ ::Appsignal.monitor_transaction(
+ 'perform_job.dispatch-rider',
+ class: message.subject,
+ method: 'handle',
+ attempts: message.receive_count,
+ queue: message.queue_name,
+ queue_time: (Time.now.to_f - message.sent_at.to_f) * 1000,
+ ) do
+ job.call
end
+
+ ::Appsignal.stop
end
end
end
end
@@ -41,12 +30,8 @@
config.around(:dispatch_message) do |job, message|
DispatchRider::Integrations::Appsignal.wrap_message(job, message)
end
- end
-
- if ::Appsignal.active?
- ::Appsignal.start
end
end