Sha256: abf46e743df235229f353bc6ceffd715f2dc80203e9d93f8307491dc1cd93526
Contents?: true
Size: 1.17 KB
Versions: 48
Compression:
Stored size: 1.17 KB
Contents
module Appsignal class Hooks class ShoryukenMiddleware def call(worker_instance, queue, sqs_msg, body) metadata = { :queue => queue } exclude_keys = [ :job_class, :queue_name, :arguments ] metadata.merge!(body.reject{ |key| exclude_keys.member?(key.to_sym) }) metadata.merge!(sqs_msg.attributes) options = { :class => body['job_class'], :method => 'perform', :metadata => metadata } options[:params] = body['arguments'] if body.key?('arguments') options[:queue_start] = Time.at(sqs_msg.attributes['SentTimestamp'].to_i / 1000) if sqs_msg.attributes.key?('SentTimestamp') Appsignal.monitor_transaction('perform_job.shoryuken', options) do yield end end end class ShoryukenHook < Appsignal::Hooks::Hook register :shoryuken def dependencies_present? defined?(::Shoryuken) end def install ::Shoryuken.configure_server do |config| config.server_middleware do |chain| chain.add Appsignal::Hooks::ShoryukenMiddleware end end end end end end
Version data entries
48 entries across 48 versions & 1 rubygems