Class: Karafka::Web::Pro::Ui::Controllers::HealthController

Inherits:
BaseController show all
Defined in:
lib/karafka/web/pro/ui/controllers/health_controller.rb

Overview

Health state controller

Constant Summary

Constants inherited from Ui::Controllers::BaseController

Ui::Controllers::BaseController::Models

Instance Attribute Summary

Attributes inherited from Ui::Controllers::BaseController

#params, #session

Instance Method Summary collapse

Methods inherited from Ui::Controllers::BaseController

#cache, #initialize

Methods included from Ui::Controllers::Requests::Hookable

included, #run_after_hooks, #run_before_hooks

Constructor Details

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

Instance Method Details

#changesObject

Displays information related to time of changes of particular attributes



104
105
106
107
108
109
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 104

def changes
  # Same data as overview but presented differently
  overview

  render
end

#cluster_lagsObject

Displays lags for routing defined consumer groups taken from the cluster and not the metrics reported. This is useful when we don’t have any consumers running but still want to check lags because it shows what Kafka sees



85
86
87
88
89
90
91
92
93
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 85

def cluster_lags
  @stats = Models::Health.cluster_lags_with_offsets

  @stats.each_value do |cg_details|
    cg_details.each_value { |topic_details| refine(topic_details) }
  end

  render
end

#lagsObject

Displays details about lags and their progression/statuses



75
76
77
78
79
80
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 75

def lags
  # Same data as overview but presented differently
  overview

  render
end

#offsetsObject

Displays details about offsets and their progression/statuses



96
97
98
99
100
101
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 96

def offsets
  # Same data as overview but presented differently
  overview

  render
end

#overviewObject

Displays the current system state



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 62

def overview
  current_state = Models::ConsumersState.current!
  @stats = Models::Health.current(current_state)

  # Refine only on a per topic basis not to resort higher levels
  @stats.each_value do |cg_details|
    cg_details.each_value { |topic_details| refine(topic_details) }
  end

  render
end