From beb991b2a6784f0e172ee8e771b9d4f8b6ecd5dd Mon Sep 17 00:00:00 2001 From: Mikhael Rakauskas Date: Thu, 21 Aug 2025 11:28:21 -0400 Subject: [PATCH] Newrelic job tracing --- app/jobs/application_job.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index d10c0717..55b41697 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,19 +1,19 @@ # frozen_string_literal: true class ApplicationJob < ActiveJob::Base - # include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation + include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation retry_on StandardError, wait: 6.seconds, attempts: 5 unless Docuseal.multitenant? - # unique :while_executing, on_conflict: :log + unique :while_executing, on_conflict: :log - # def perform(*args) - # receiver_str, _, message = args.shift.rpartition('.') - # time = Benchmark.measure do - # receiver_str.constantize.send(message, *args) - # end - # Rails.logger.info( - # "Finished #{receiver_str}.#{message}(#{args.map(&:to_s).join(', ')}): #{time}" - # ) - # end - # add_transaction_tracer :perform, category: :task + def perform(*args) + receiver_str, _, message = args.shift.rpartition('.') + time = Benchmark.measure do + receiver_str.constantize.send(message, *args) + end + Rails.logger.info( + "Finished #{receiver_str}.#{message}(#{args.map(&:to_s).join(', ')}): #{time}" + ) + end + add_transaction_tracer :perform, category: :task end