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

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

Overview

Main Karafka Pro Web-Ui dashboard controller

Instance Method Summary collapse

Methods inherited from Controllers::Base

#initialize

Constructor Details

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

Instance Method Details

#indexObject

View with statistics dashboard details



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/karafka/web/ui/pro/controllers/dashboard.rb', line 22

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)
  )

  # Build the charts data about topics using the consumers groups metrics
  @topics = Models::Metrics::Topics.new(
    current_metrics.to_h.fetch(:consumer_groups)
  )

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

  @topics_charts = Models::Metrics::Charts::Topics.new(
    @topics, @params.current_range
  )

  render
end