Sha256: 34d837daffbbe45e09861b7106fecd0404f6e059d4a8870b47d68c65ab3075d5

Contents?: true

Size: 821 Bytes

Versions: 7

Compression:

Stored size: 821 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  class PerformanceController < ApplicationController
    def index
      @performances = GoodJob::Execution.group(:job_class).select("
        job_class,
        COUNT(*) AS executions_count,
        AVG(duration) AS avg_duration,
        MIN(duration) AS min_duration,
        MAX(duration) AS max_duration
      ").order(:job_class)

      @queue_performances = GoodJob::Execution.group(:queue_name).select("
        queue_name,
        COUNT(*) AS executions_count,
        AVG(duration) AS avg_duration,
        MIN(duration) AS min_duration,
        MAX(duration) AS max_duration
      ").order(:queue_name)
    end

    def show
      representative_job = GoodJob::Job.find_by!(job_class: params[:id])
      @job_class = representative_job.job_class
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
good_job-4.9.3 app/controllers/good_job/performance_controller.rb
good_job-4.9.2 app/controllers/good_job/performance_controller.rb
good_job-4.9.1 app/controllers/good_job/performance_controller.rb
good_job-4.9.0 app/controllers/good_job/performance_controller.rb
good_job-4.8.2 app/controllers/good_job/performance_controller.rb
good_job-4.8.1 app/controllers/good_job/performance_controller.rb
good_job-4.8.0 app/controllers/good_job/performance_controller.rb