Class: Appsignal::EventFormatter::ActiveJob::PerformFormatter

Inherits:
Appsignal::EventFormatter show all
Defined in:
lib/appsignal/event_formatter/active_job/perform_formatter.rb

Overview

Active Job reports the job it is running as a perform.active_job notification. The job's own transaction already carries its title, so this formatter only describes the event as the work of performing a job.

Constant Summary collapse

PERFORM_ATTRIBUTES =
Appsignal::OpenTelemetry::Messaging.perform_attributes("active_job").freeze

Constants inherited from Appsignal::EventFormatter

DEFAULT, SQL_BODY_FORMAT

Instance Method Summary collapse

Methods inherited from Appsignal::EventFormatter

register, registered?, unregister

Instance Method Details

#opentelemetry_attributes(payload) ⇒ Object



15
16
17
18
19
# File 'lib/appsignal/event_formatter/active_job/perform_formatter.rb', line 15

def opentelemetry_attributes(payload)
  PERFORM_ATTRIBUTES.merge(
    { "messaging.destination.name" => queue_name(payload) }.compact
  )
end

#queue_name(payload) ⇒ Object

The queue the job being performed is on, which the notification carries as the job itself.



23
24
25
26
# File 'lib/appsignal/event_formatter/active_job/perform_formatter.rb', line 23

def queue_name(payload)
  job = payload[:job]
  job.queue_name if job.respond_to?(:queue_name)
end