Class: Appsignal::Hooks::ShoryukenMiddleware Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/hooks/shoryuken.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#call(worker_instance, queue, sqs_msg, body) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/appsignal/hooks/shoryuken.rb', line 7

def call(worker_instance, queue, sqs_msg, body)
   = { :queue => queue }.merge(sqs_msg.attributes)
  options = {
    :class => worker_instance.class.name,
    :method => "perform",
    :metadata => 
  }

  args = body.is_a?(Hash) ? body : { :params => body }
  options[:params] = Appsignal::Utils::HashSanitizer.sanitize(
    args,
    Appsignal.config[:filter_parameters]
  )

  if sqs_msg.attributes.key?("SentTimestamp")
    options[:queue_start] = Time.at(sqs_msg.attributes["SentTimestamp"].to_i / 1000)
  end

  Appsignal.monitor_transaction("perform_job.shoryuken", options) do
    yield
  end
end