Class: Exekutor::Plugins::Appsignal

Inherits:
Object
  • Object
show all
Includes:
Hook
Defined in:
lib/exekutor/plugins/appsignal.rb

Overview

Hooks to send job execution info and raised errors to Appsignal

Instance Method Summary collapse

Methods included from Hook

#callbacks

Instance Method Details

#invoke_with_instrumentation(job) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/exekutor/plugins/appsignal.rb', line 17

def invoke_with_instrumentation(job)
  payload = job[:payload]
  params = ::Appsignal::Utils::HashSanitizer.sanitize(
    payload.fetch("arguments", {}),
    ::Appsignal.config[:filter_parameters]
  )

  ::Appsignal.monitor_transaction(
    "perform_job.exekutor",
    class: payload["job_class"],
    method: "perform",
    params: params,
    metadata: {
      id: payload["job_id"],
      queue: payload["queue_name"],
      priority: payload.fetch("priority", Exekutor.config.default_queue_priority),
      attempts: payload.fetch("attempts", 0)
    },
    queue_start: job[:scheduled_at]
  ) do
    yield job
  end
end

#report_error(error) ⇒ Object



41
42
43
# File 'lib/exekutor/plugins/appsignal.rb', line 41

def report_error(error)
  ::Appsignal.add_exception(error)
end