Class: Karafka::Web::Ui::Models::Counters

Inherits:
Lib::HashProxy show all
Defined in:
lib/karafka/web/ui/models/counters.rb

Overview

Represents the top counters bar values on the consumers view

Instance Method Summary collapse

Methods inherited from Lib::HashProxy

#method_missing, #respond_to_missing?, #to_h

Constructor Details

#initialize(state) ⇒ Counters

Returns a new instance of Counters.

Parameters:

  • state (Hash)


15
16
17
18
# File 'lib/karafka/web/ui/models/counters.rb', line 15

def initialize(state)
  super(state[:stats])
  @hash[:errors] = estimate_errors_count
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Karafka::Web::Ui::Lib::HashProxy

Instance Method Details

#pendingInteger

Returns number of jobs that are not yet running. This includes jobs on the workers queue as well as jobs in the scheduling.

Returns:

  • (Integer)

    number of jobs that are not yet running. This includes jobs on the workers queue as well as jobs in the scheduling



22
23
24
# File 'lib/karafka/web/ui/models/counters.rb', line 22

def pending
  enqueued + waiting
end