Module: Karafka::Web::Ui::Models::Processes

Extended by:
Core::Helpers::Time
Defined in:
lib/karafka/web/ui/models/processes.rb

Overview

Note:

Active also includes processes stopped recently. We use it to provide better visibility via UI.

Represents the active processes data

Class Method Summary collapse

Class Method Details

.active(state) ⇒ Array<Process>

Returns the active processes in an array and alongside of that the current state of the system. We use those together in the UI and it would be expensive to pick it up while we’ve already had it.

Parameters:

  • state (State)

    current system state from which we can get processes metadata

Returns:



20
21
22
23
24
25
26
27
28
# File 'lib/karafka/web/ui/models/processes.rb', line 20

def active(state)
  messages = fetch_reports(state)
  messages = squash_processes_data(messages)
  processes = messages.map(&:payload)
  evict_expired_processes(processes)
  processes = sort_processes(processes)

  processes.map { |process_hash| Process.new(process_hash) }
end