diff --git a/lib/roqua/support/errors.rb b/lib/roqua/support/errors.rb index 341dcc22e4ee8d689b72eea092cd6de5c32829fe..151042e168c20d60926c4898b9d6d99d10fa5c33 100644 --- a/lib/roqua/support/errors.rb +++ b/lib/roqua/support/errors.rb @@ -82,7 +82,10 @@ module Roqua current_transaction.set_tags(labels) current_transaction.add_exception(exception) else - Appsignal.send_error exception, labels, namespace + Appsignal.send_error exception do |transaction| + transaction.set_tags labels + transaction.set_namespace namespace + end end end end diff --git a/roqua-support.gemspec b/roqua-support.gemspec index 32a7285105e1f81a09160f53f6c1cd31226b9cd2..826438dbf9bb8fc252012cb910751ebc19c98d89 100644 --- a/roqua-support.gemspec +++ b/roqua-support.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |gem| gem.add_dependency 'active_interaction', '>= 3.0', '< 5.0' gem.add_dependency 'naught', '~> 1.0' gem.add_dependency 'with_advisory_lock', '~> 3.2' - gem.add_dependency 'appsignal', '>= 2.9', '< 2.11' + gem.add_dependency 'appsignal', '>= 2.9', '< 3.1' gem.add_development_dependency 'bundler', '~> 2.0' gem.add_development_dependency 'delayed_job_active_record' diff --git a/spec/roqua/support/errors_spec.rb b/spec/roqua/support/errors_spec.rb index acd2da7b30523e48f8000e70e97501d5baa5d4e2..625ae54e64962e03a71d9dc67e8b8e9f6ca39047 100644 --- a/spec/roqua/support/errors_spec.rb +++ b/spec/roqua/support/errors_spec.rb @@ -106,16 +106,21 @@ describe 'Error reporting' do end it 'defaults to a background job' do - expect(Appsignal).to receive(:send_error).with(exception, {}, Appsignal::Transaction::BACKGROUND_JOB) + transaction = Appsignal::Transaction.new(SecureRandom.uuid, Appsignal::Transaction::FRONTEND, nil) + expect(Appsignal).to receive(:send_error).with(exception).and_yield(transaction) Roqua::Support::Errors.report exception + expect(transaction.namespace).to eq Appsignal::Transaction::BACKGROUND_JOB end it 'it will send an error under the provided category' do + transaction = Appsignal::Transaction.new(SecureRandom.uuid, Appsignal::Transaction::FRONTEND, nil) expect(Appsignal) .to receive(:send_error) - .with(exception, {a: 'b'}, Appsignal::Transaction::HTTP_REQUEST) + .with(exception).and_yield(transaction) Roqua::Support::Errors.report exception, a: 'b', namespace: :web + expect(transaction.namespace).to eq Appsignal::Transaction::HTTP_REQUEST + expect(transaction.tags).to eq a: 'b' end describe 'when a current transaction is present' do