Sha256: 30292a43a13fce16ddae83c4991b70efbf81526ab93490c9f540387f1bb51509

Contents?: true

Size: 911 Bytes

Versions: 4

Compression:

Stored size: 911 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  class MetricsController < ApplicationController
    def primary_nav
      jobs_count = GoodJob::Job.count
      batches_count = GoodJob::BatchRecord.all.size
      cron_entries_count = GoodJob::CronEntry.all.size
      processes_count = GoodJob::Process.active.count
      discarded_count = GoodJob::Job.discarded.count

      render json: {
        jobs_count: helpers.number_to_human(jobs_count),
        batches_count: helpers.number_to_human(batches_count),
        cron_entries_count: helpers.number_to_human(cron_entries_count),
        processes_count: helpers.number_to_human(processes_count),
        discarded_count: helpers.number_to_human(discarded_count),
      }
    end

    def job_status
      @filter = JobsFilter.new(params)

      render json: @filter.states.transform_values { |count| helpers.number_with_delimiter(count) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
good_job-4.7.0 app/controllers/good_job/metrics_controller.rb
good_job-4.6.0 app/controllers/good_job/metrics_controller.rb
good_job-4.5.1 app/controllers/good_job/metrics_controller.rb
good_job-4.5.0 app/controllers/good_job/metrics_controller.rb