module InstJobsStatsd::Stats::Periodic::Run
Public Class Methods
enable()
click to toggle source
# File lib/inst_jobs_statsd/stats/periodic/run.rb, line 5 def self.enable enable_run_depth enable_run_age end
enable_run_age()
click to toggle source
# File lib/inst_jobs_statsd/stats/periodic/run.rb, line 15 def self.enable_run_age Periodic.enable_callbacks Periodic.add(-> { report_run_age }) end
enable_run_depth()
click to toggle source
# File lib/inst_jobs_statsd/stats/periodic/run.rb, line 10 def self.enable_run_depth Periodic.enable_callbacks Periodic.add(-> { report_run_depth }) end
report_run_age()
click to toggle source
# File lib/inst_jobs_statsd/stats/periodic/run.rb, line 25 def self.report_run_age jobs_run_at = running_jobs_scope.limit(10_000).pluck(:run_at) age_secs = jobs_run_at.map { |t| Delayed::Job.db_time_now - t } Periodic.report_gauge(:run_age_total, age_secs.sum) Periodic.report_gauge(:run_age_max, age_secs.max) end
report_run_depth()
click to toggle source
# File lib/inst_jobs_statsd/stats/periodic/run.rb, line 20 def self.report_run_depth scope = running_jobs_scope Periodic.report_gauge(:run_depth, scope.count) end
running_jobs_scope()
click to toggle source
# File lib/inst_jobs_statsd/stats/periodic/run.rb, line 32 def self.running_jobs_scope Delayed::Job.running end