Module: Appsignal::Hooks::ActiveJobHook::ActiveJobHelpers Private
- Defined in:
- lib/appsignal/hooks/active_job.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- ACTION_MAILER_CLASSES =
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.
[ "ActionMailer::DeliveryJob", "ActionMailer::Parameterized::DeliveryJob", "ActionMailer::MailDeliveryJob" ].freeze
Class Method Summary collapse
- .action_name(job) ⇒ Object private
- .increment_counter(key, value, tags = {}) ⇒ Object private
-
.metrics_for(job) ⇒ Array
private
Returns an array of metrics with tags used to report the job metrics.
- .transaction_tags_for(job) ⇒ Object private
Class Method Details
.action_name(job) ⇒ 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.
93 94 95 96 97 98 99 100 |
# File 'lib/appsignal/hooks/active_job.rb', line 93 def self.action_name(job) case job["job_class"] when *ACTION_MAILER_CLASSES job["arguments"][0..1].join("#") else "#{job["job_class"]}#perform" end end |
.increment_counter(key, value, tags = {}) ⇒ 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.
133 134 135 |
# File 'lib/appsignal/hooks/active_job.rb', line 133 def self.increment_counter(key, value, = {}) Appsignal.increment_counter "active_job_#{key}", value, end |
.metrics_for(job) ⇒ Array
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.
Returns an array of metrics with tags used to report the job metrics
If job ONLY has a queue, it will return queue_job_count
with tags.
If job has a queue AND priority, it will ALSO return
queue_priority_job_count
with tags.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/appsignal/hooks/active_job.rb', line 109 def self.metrics_for(job) = { :queue => job["queue_name"] } metrics = [["queue_job_count", ]] priority = job["priority"] if priority metrics << [ "queue_priority_job_count", .merge(:priority => priority) ] end metrics end |
.transaction_tags_for(job) ⇒ 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.
124 125 126 127 128 129 130 131 |
# File 'lib/appsignal/hooks/active_job.rb', line 124 def self.(job) = {} queue = job["queue_name"] [:queue] = queue if queue priority = job["priority"] [:priority] = priority if priority end |