Class: Karafka::Web::Ui::Models::Status::Checks::Partitions

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/ui/models/status/checks/partitions.rb

Overview

Checks if required Web UI topics have the correct number of partitions.

The consumers states, reports, and metrics topics must have exactly 1 partition each for the Web UI to function correctly. The errors topic can have any number of partitions.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

depends_on, independent!, independent?, #initialize

Constructor Details

This class inherits a constructor from Karafka::Web::Ui::Models::Status::Checks::Base

Class Method Details

.halted_detailsHash

Returns empty hash for halted state.

Returns:

  • (Hash)

    empty hash for halted state



19
20
21
# File 'lib/karafka/web/ui/models/status/checks/partitions.rb', line 19

def halted_details
  {}
end

Instance Method Details

#callStatus::Step

Executes the partitions check.

Verifies that state, reports, and metrics topics have exactly 1 partition.

Returns:

  • (Status::Step)

    result with topic details including partition counts



29
30
31
32
33
34
35
36
37
38
# File 'lib/karafka/web/ui/models/status/checks/partitions.rb', line 29

def call
  details = context.topics_details

  status = :success
  status = :failure if details[context.topics_consumers_states][:partitions] != 1
  status = :failure if details[context.topics_consumers_reports][:partitions] != 1
  status = :failure if details[context.topics_consumers_metrics][:partitions] != 1

  step(status, details)
end