Sha256: 243b141db1ce5d8b75172ad6659a420e5a160a132dc5d54cb3bdeb78cb32d2dc
Contents?: true
Size: 641 Bytes
Versions: 12
Compression:
Stored size: 641 Bytes
Contents
require_relative 'base_probe' module Roqua module Probes class MonitoringProbe include BaseProbe def incomplete_jobs Roqua::Scheduling::CronJob.where('completed_at IS NULL OR completed_at < next_run_at') end def longest_delay_in_minutes delays = incomplete_jobs.pluck(:next_run_at).map do |next_run_at| Time.now - next_run_at end longest_delay_in_seconds = ([0] + delays).max (longest_delay_in_seconds / 1.minute).to_i end def run Appsignal.set_gauge('scheduler_delay_in_minutes', longest_delay_in_minutes) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems