Class: Karafka::Web::Ui::Models::Status::Checks::InitialConsumersMetrics
- Inherits:
-
Base
- Object
- Base
- Karafka::Web::Ui::Models::Status::Checks::InitialConsumersMetrics
- Defined in:
- lib/karafka/web/ui/models/status/checks/initial_consumers_metrics.rb
Overview
Checks if the initial consumers metrics are present and can be deserialized.
The consumers metrics topic must contain valid data that can be parsed. This check fetches the current metrics and attempts to deserialize it.
Class Method Summary collapse
-
.halted_details ⇒ Hash
Details indicating presence issue for halted state.
Instance Method Summary collapse
-
#call ⇒ Status::Step
Executes the initial consumers metrics check.
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_details ⇒ Hash
Returns details indicating presence issue for halted state.
18 19 20 |
# File 'lib/karafka/web/ui/models/status/checks/initial_consumers_metrics.rb', line 18 def halted_details { issue_type: :presence } end |
Instance Method Details
#call ⇒ Status::Step
Executes the initial consumers metrics check.
Fetches the current consumers metrics from Kafka and verifies it can be deserialized. Caches the result in context for subsequent checks.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/karafka/web/ui/models/status/checks/initial_consumers_metrics.rb', line 29 def call details = { issue_type: :presence } begin context.current_metrics ||= Models::ConsumersMetrics.current status = context.current_metrics ? :success : :failure rescue JSON::ParserError status = :failure details[:issue_type] = :deserialization end step(status, details) end |