Sha256: 6b685b2461ba5161aac0d9156096349ad869b388cc6ba4021277f378bfb219b3

Contents?: true

Size: 839 Bytes

Versions: 4

Compression:

Stored size: 839 Bytes

Contents

if defined? Appsignal
  ::Appsignal.logger.info('Loading Dispatch Rider integration')

  module DispatchRider
    module Integrations
      module Appsignal

        def self.wrap_message(job, message)
          ::Appsignal.start

          ::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

  DispatchRider.configure do |config|

    config.around(:dispatch_message) do |job, message|
      DispatchRider::Integrations::Appsignal.wrap_message(job, message)
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dispatch-rider-1.9.0 lib/dispatch-rider/integrations/appsignal.rb
dispatch-rider-1.8.6 lib/dispatch-rider/integrations/appsignal.rb
dispatch-rider-1.8.5 lib/dispatch-rider/integrations/appsignal.rb
dispatch-rider-1.8.4 lib/dispatch-rider/integrations/appsignal.rb