Class: Skylight::Core::Normalizers::ActiveJob::Perform Private

Inherits:
Normalizer
  • Object
show all
Defined in:
lib/skylight/core/normalizers/active_job/perform.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.

Constant Summary collapse

DELIVERY_JOB =

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

/\AActionMailer::(Mail)?DeliveryJob\Z/.freeze
DELAYED_JOB_WRAPPER =

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

"ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper".freeze
CAT =

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

"app.job.perform".freeze

Instance Attribute Summary

Attributes inherited from Normalizer

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Normalizer

#initialize, register

Constructor Details

This class inherits a constructor from Skylight::Core::Normalizers::Normalizer

Class Method Details

.normalize_title(job_instance) ⇒ 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.



10
11
12
13
14
15
16
17
# File 'lib/skylight/core/normalizers/active_job/perform.rb', line 10

def self.normalize_title(job_instance)
  job_instance.class.name.to_s.tap do |str|
    if str.match(DELIVERY_JOB)
      mailer_class, mailer_method, * = job_instance.arguments
      return ["#{mailer_class}##{mailer_method}", str]
    end
  end
end

Instance Method Details

#normalize(trace, _name, payload) ⇒ 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.



21
22
23
24
25
26
27
28
29
# File 'lib/skylight/core/normalizers/active_job/perform.rb', line 21

def normalize(trace, _name, payload)
  title = payload[:job].class.to_s
  adapter_name = normalize_adapter_name(payload[:adapter])
  desc = "{ adapter: '#{adapter_name}', queue: '#{payload[:job].queue_name}' }"

  maybe_set_endpoint(trace, payload)

  [CAT, title, desc]
end

#normalize_after(trace, _span, _name, payload) ⇒ 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.



31
32
33
34
35
# File 'lib/skylight/core/normalizers/active_job/perform.rb', line 31

def normalize_after(trace, _span, _name, payload)
  return unless config.enable_segments? && assign_endpoint?(trace, payload)

  trace.segment = payload[:job].queue_name
end