Sha256: 49efadf83ab80e440f31ebdc028e70fbcebfafbcec9b1e9c2a17dae190bff399

Contents?: true

Size: 1.81 KB

Versions: 11

Compression:

Stored size: 1.81 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 Ui
      module Pro
        module Controllers
          # Main Karafka Pro Web-Ui dashboard controller
          class Dashboard < Ui::Controllers::Base
            # 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
              )

              respond
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
karafka-web-0.7.10 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.9 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.8 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.7 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.6 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.5 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.4 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.3 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.2 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.1 lib/karafka/web/ui/pro/controllers/dashboard.rb
karafka-web-0.7.0 lib/karafka/web/ui/pro/controllers/dashboard.rb