Class: RubyLLM::Agents::DashboardController Private

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/ruby_llm/agents/dashboard_controller.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Dashboard controller for the RubyLLM::Agents observability UI

Displays high-level statistics, recent executions, and activity charts for monitoring agent performance at a glance.

Instance Method Summary collapse

Instance Method Details

#chart_dataJSON

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns chart data as JSON for live updates

Parameters:

  • range (String)

    Time range: “today”, “7d”, “30d”, “90d”, or “custom”

Returns:

  • (JSON)

    Chart data with series



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/ruby_llm/agents/dashboard_controller.rb', line 40

def chart_data
  range = sanitize_range(params[:range])
  scope = tenant_scoped_executions

  data = if range == "custom"
    from = parse_date(params[:from])
    to = parse_date(params[:to])
    if from && to
      from, to = [from, to].sort
      to = [to, Date.current].min
      scope.activity_chart_json_for_dates(from: from, to: to)
    else
      scope.activity_chart_json(range: "today")
    end
  else
    scope.activity_chart_json(range: range)
  end

  render json: data
end

#indexvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Renders the main dashboard view

Loads now strip data, critical alerts, hourly activity, recent executions, agent comparison, and top errors.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/ruby_llm/agents/dashboard_controller.rb', line 20

def index
  @selected_range = sanitize_range(params[:range])
  @days = range_to_days(@selected_range)
  parse_custom_dates if @selected_range == "custom"
  base_scope = tenant_scoped_executions
  @now_strip = build_now_strip(base_scope)
  @critical_alerts = load_critical_alerts(base_scope)
  @recent_executions = base_scope.includes(:detail).recent(10)
  @agent_stats = build_agent_comparison(base_scope)
  @top_errors = build_top_errors(base_scope)
  @tenant_budget = load_tenant_budget(base_scope)
  @model_stats = build_model_stats(base_scope)
  @cache_savings = build_cache_savings(base_scope)
  @top_tenants = build_top_tenants
end