Skip to content

Commit

Permalink
Use queue_name directly and not self.class.queue_name
Browse files Browse the repository at this point in the history
  • Loading branch information
cokeeffe committed May 18, 2020
1 parent f35420b commit 7e07232
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/active_job/stats/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ module Callbacks
def benchmark_stats
require 'active_support/core_ext/benchmark'
benchmark = Benchmark.ms { yield }
ActiveJob::Stats.reporter.timing("#{self.class.queue_name}.processed", benchmark)
ActiveJob::Stats.reporter.timing("#{queue_name}.processed", benchmark)
ActiveJob::Stats.reporter.timing("#{self.class}.processed", benchmark)
ActiveJob::Stats.reporter.timing("#{self.class}.#{ENV['RAILS_ENV']}.processed", benchmark)
end

def before_perform_stats
ActiveJob::Stats.reporter.increment("#{self.class.queue_name}.started")
ActiveJob::Stats.reporter.increment("#{queue_name}.started")
ActiveJob::Stats.reporter.increment("#{self.class}.started")
ActiveJob::Stats.reporter.increment("#{self.class}.#{ENV['RAILS_ENV']}.started")
ActiveJob::Stats.reporter.increment('total.started')
end

def after_enqueue_stats
ActiveJob::Stats.reporter.increment("#{self.class.queue_name}.enqueued")
ActiveJob::Stats.reporter.increment("#{queue_name}.enqueued")
ActiveJob::Stats.reporter.increment("#{self.class}.enqueued")
ActiveJob::Stats.reporter.increment("#{self.class}.#{ENV['RAILS_ENV']}.enqueued")
ActiveJob::Stats.reporter.increment('total.enqueued')
end

def after_perform_stats
ActiveJob::Stats.reporter.increment("#{self.class.queue_name}.finished")
ActiveJob::Stats.reporter.increment("#{queue_name}.finished")
ActiveJob::Stats.reporter.increment("#{self.class}.finished")
ActiveJob::Stats.reporter.increment("#{self.class}.#{ENV['RAILS_ENV']}.finished")
ActiveJob::Stats.reporter.increment('total.finished')
Expand Down

0 comments on commit 7e07232

Please sign in to comment.