Class: Karafka::Web::Ui::Models::ConsumersState
- Inherits:
-
Lib::HashProxy
- Object
- Lib::HashProxy
- Karafka::Web::Ui::Models::ConsumersState
- Extended by:
- Core::Helpers::Time
- Defined in:
- lib/karafka/web/ui/models/consumers_state.rb
Overview
Represents the current consumer processes aggregated state This state is the core of Karafka reporting. It holds the most important aggregated data as well as pointers to states of particular consumers and their details.
Class Method Summary collapse
-
.current ⇒ State, false
Current aggregated state or false if not found.
-
.current! ⇒ State
Current aggregated state.
Methods inherited from Lib::HashProxy
#initialize, #method_missing, #respond_to_missing?, #to_h
Constructor Details
This class inherits a constructor from Karafka::Web::Ui::Lib::HashProxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Karafka::Web::Ui::Lib::HashProxy
Class Method Details
.current ⇒ State, false
Current state may contain expired data, for example of processes that were forcefully killed, etc. We clean this prior to returning the state.
Returns current aggregated state or false if not found.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/karafka/web/ui/models/consumers_state.rb', line 17 def current state = fetch return false unless state # Do not return the state in case web-ui is not enabled because we need our # internal deserializer for it to operate. False will force user to go to the # status page return false unless Models::Status.new.enabled.success? state = state.payload evict_expired_processes(state) sort_processes(state) new(state) end |
.current! ⇒ State
Returns current aggregated state.
36 37 38 |
# File 'lib/karafka/web/ui/models/consumers_state.rb', line 36 def current! current || raise(::Karafka::Web::Errors::Ui::NotFoundError) end |