diff options
Diffstat (limited to 'app/workers/concerns')
-rw-r--r-- | app/workers/concerns/application_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/concerns/limited_capacity/worker.rb | 7 | ||||
-rw-r--r-- | app/workers/concerns/reenqueuer.rb | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/app/workers/concerns/application_worker.rb b/app/workers/concerns/application_worker.rb index 30dec5159a2..d101ef100d8 100644 --- a/app/workers/concerns/application_worker.rb +++ b/app/workers/concerns/application_worker.rb @@ -19,7 +19,7 @@ module ApplicationWorker def structured_payload(payload = {}) context = Labkit::Context.current.to_h.merge( - 'class' => self.class, + 'class' => self.class.name, 'job_status' => 'running', 'queue' => self.class.queue, 'jid' => jid diff --git a/app/workers/concerns/limited_capacity/worker.rb b/app/workers/concerns/limited_capacity/worker.rb index c0d6bfff2f5..b5a97e49300 100644 --- a/app/workers/concerns/limited_capacity/worker.rb +++ b/app/workers/concerns/limited_capacity/worker.rb @@ -67,6 +67,7 @@ module LimitedCapacity return unless has_capacity? job_tracker.register(jid) + report_running_jobs_metrics perform_work(*args) rescue => exception raise @@ -108,11 +109,15 @@ module LimitedCapacity end def report_prometheus_metrics(*args) - running_jobs_gauge.set(prometheus_labels, running_jobs_count) + report_running_jobs_metrics remaining_work_gauge.set(prometheus_labels, remaining_work_count(*args)) max_running_jobs_gauge.set(prometheus_labels, max_running_jobs) end + def report_running_jobs_metrics + running_jobs_gauge.set(prometheus_labels, running_jobs_count) + end + def required_jobs_count(*args) [ remaining_work_count(*args), diff --git a/app/workers/concerns/reenqueuer.rb b/app/workers/concerns/reenqueuer.rb index bf6f6546c03..6f399b6d90b 100644 --- a/app/workers/concerns/reenqueuer.rb +++ b/app/workers/concerns/reenqueuer.rb @@ -13,7 +13,7 @@ # - `#lease_timeout` # # The worker spec should include `it_behaves_like 'reenqueuer'` and -# `it_behaves_like 'it is rate limited to 1 call per'`. +# `it_behaves_like '#perform is rate limited to 1 call per'`. # # Optionally override `#minimum_duration` to adjust the rate limit. # |