Class: Karafka::Web::Ui::Controllers::Dashboard

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/ui/controllers/dashboard.rb

Overview

Main Karafka Pro Web-Ui dashboard controller

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Karafka::Web::Ui::Controllers::Base

Instance Method Details

#indexObject

View with statistics dashboard details



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/karafka/web/ui/controllers/dashboard.rb', line 10

def index
  @current_state = Models::ConsumersState.current!
  @counters = Models::Counters.new(@current_state)

  current_metrics = Models::ConsumersMetrics.current!

  # Build the charts data using the aggregated metrics
  @aggregated = Models::Metrics::Aggregated.new(
    current_metrics.to_h.fetch(:aggregated)
  )

  # Load only historicals for the selected range
  @aggregated_charts = Models::Metrics::Charts::Aggregated.new(
    @aggregated, @params.current_range
  )

  render
end