Sha256: d806e9da7ed237d8ef3e0c5393d9c3040d0f41d2ed0b06327a429ea63aae1b56

Contents?: true

Size: 1.84 KB

Versions: 13

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

# This Karafka component is a Pro component under a commercial license.
# This Karafka component is NOT licensed under LGPL.
#
# All of the commercial components are present in the lib/karafka/pro directory of this
# repository and their usage requires commercial license agreement.
#
# Karafka has also commercial-friendly license, commercial support and commercial components.
#
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
# your code to Maciej Mensfeld.

module Karafka
  module Web
    module Pro
      module Ui
        module Controllers
          # Main Karafka Pro Web-Ui dashboard controller
          class DashboardController < BaseController
            include Web::Ui

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

              # 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
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
karafka-web-0.10.4 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.10.3 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.10.2 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.10.1 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.10.0 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.10.0.rc2 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.10.0.rc1 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.10.0.beta1 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.9.1 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0.rc3 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0.rc2 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb
karafka-web-0.9.0.rc1 lib/karafka/web/pro/ui/controllers/dashboard_controller.rb