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 Method Summary collapse

Methods inherited from Ui::Controllers::BaseController

#initialize

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



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

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



68
69
70
71
72
73
74
75
76
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 68

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



58
59
60
61
62
63
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 58

def lags
  # Same data as overview but presented differently
  overview

  render
end

#offsetsObject

Displays details about offsets and their progression/statuses



79
80
81
82
83
84
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 79

def offsets
  # Same data as overview but presented differently
  overview

  render
end

#overviewObject

Displays the current system state



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/karafka/web/pro/ui/controllers/health_controller.rb', line 45

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