Sha256: 8116632055067d33989dba28057500ba2bb42007d79af635cb7cc5c747473e7c
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
module TransactionHelpers def transaction_with_exception appsignal_transaction.tap do |o| begin raise ArgumentError, 'oh no' rescue ArgumentError => exception env = {} o.add_exception( Appsignal::ExceptionNotification.new(env, exception) ) end end end def regular_transaction appsignal_transaction(:process_action_event => notification_event) end def slow_transaction(args={}) time = Time.parse('01-01-2001 10:01:00') appsignal_transaction( { :process_action_event => notification_event( :start => time, :ending => time + Appsignal.config[:slow_request_threshold] / 1000.0 ) }.merge(args) ) end def slower_transaction(args={}) time = Time.parse('01-01-2001 10:01:00') appsignal_transaction( { :process_action_event => notification_event( :start => time, :ending => time + Appsignal.config[:slow_request_threshold] / 500.0 ) }.merge(args) ) end def appsignal_transaction(args = {}) process_action_event = args.delete(:process_action_event) events = args.delete(:events) || [ notification_event(:name => 'query.mongoid') ] exception = args.delete(:exception) Appsignal::Transaction.create( '1', { 'HTTP_USER_AGENT' => 'IE6', 'SERVER_NAME' => 'localhost', 'action_dispatch.routes' => 'not_available' }.merge(args) ).tap do |o| o.set_process_action_event(process_action_event) o.add_exception(exception) events.each { |event| o.add_event(event) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appsignal-0.5.0 | spec/support/helpers/transaction_helpers.rb |