Sha256: f497c853a05898bc4a1e7281df18e5074782e5b82eb553f8c7f4d3373878bceb

Contents?: true

Size: 943 Bytes

Versions: 5

Compression:

Stored size: 943 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Ui
      module Controllers
        # Main Karafka Pro Web-Ui dashboard controller
        class DashboardController < Ui::Controllers::BaseController
          # View with statistics dashboard details
          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
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
karafka-web-0.9.1 lib/karafka/web/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0 lib/karafka/web/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0.rc3 lib/karafka/web/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0.rc2 lib/karafka/web/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0.rc1 lib/karafka/web/ui/controllers/dashboard_controller.rb