class Telegraf::ActiveJob
This class collects ActiveJob
queue metrics and sends them to telegraf.
Tags:
-
`queue`:
The queue this job landed on.
-
`job`:
The name of the job class that was executed.
-
`errors`:
Whether or not this job errored.
Values:
-
`app_ms`:
Total job processing time.
Public Class Methods
new(agent:, series: 'active_job', tags: {})
click to toggle source
# File lib/telegraf/active_job.rb, line 27 def initialize(agent:, series: 'active_job', tags: {}) @agent = agent @series = series.to_s.freeze @tags = tags.freeze end
Public Instance Methods
call(_name, start, finish, _id, payload)
click to toggle source
# File lib/telegraf/active_job.rb, line 33 def call(_name, start, finish, _id, payload) job = payload[:job] @agent.write( @series, tags: { **@tags, job: job.class.name, queue: job.queue_name, errors: payload.key?(:exception_object) }, values: { app_ms: ((finish - start) * 1000.0) # milliseconds } ) end