Class: RakeAudit::DashboardController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rake_audit/dashboard_controller.rb

Overview

Renders the dashboard: six aggregate metrics plus the ten task names with the most failures. All data access is delegated to web_adapter so the controller is backend-agnostic (ActiveRecord, Redis, Mongo, …).

Instance Method Summary collapse

Instance Method Details

#indexvoid

This method returns an undefined value.

Compute the dashboard aggregates and expose them as instance variables. All five metrics are fetched via a single web_adapter.stats call so adapters can compute them in one pass (e.g. one Redis LRANGE instead of five).



13
14
15
16
17
18
19
20
21
# File 'app/controllers/rake_audit/dashboard_controller.rb', line 13

def index
  s = web_adapter.stats
  @total               = s[:total]
  @success_count       = s[:success_count]
  @failure_count       = s[:failure_count]
  @failure_rate        = failure_rate(@failure_count, @total)
  @average_duration_ms = s[:average_duration_ms]
  @top_failed_tasks    = s[:top_failed_tasks]
end