Class: Karafka::Web::Ui::Models::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/web/ui/models/status.rb,
lib/karafka/web/ui/models/status/step.rb,
lib/karafka/web/ui/models/status/context.rb,
lib/karafka/web/ui/models/status/checks/base.rb,
lib/karafka/web/ui/models/status/checks/topics.rb,
lib/karafka/web/ui/models/status/checks/enabled.rb,
lib/karafka/web/ui/models/status/checks/connection.rb,
lib/karafka/web/ui/models/status/checks/partitions.rb,
lib/karafka/web/ui/models/status/checks/replication.rb,
lib/karafka/web/ui/models/status/checks/live_reporting.rb,
lib/karafka/web/ui/models/status/checks/pro_subscription.rb,
lib/karafka/web/ui/models/status/checks/consumers_reports.rb,
lib/karafka/web/ui/models/status/checks/consumers_schemas.rb,
lib/karafka/web/ui/models/status/checks/materializing_lag.rb,
lib/karafka/web/ui/models/status/checks/state_calculation.rb,
lib/karafka/web/ui/models/status/checks/commands_topic_presence.rb,
lib/karafka/web/ui/models/status/checks/initial_consumers_state.rb,
lib/karafka/web/ui/models/status/checks/routing_topics_presence.rb,
lib/karafka/web/ui/models/status/checks/initial_consumers_metrics.rb,
lib/karafka/web/ui/models/status/checks/consumers_reports_schema_state.rb

Overview

Model that represents the general status of the Web UI.

We use this data to display a status page that helps with debugging on what is missing in the overall setup of the Web UI.

People have various problems like too many partitions, not created topics, etc. and this data and view aims to help them with understanding the current status of the setup.

The Status model uses a DSL-based architecture where each check is a separate class that declares its dependencies and behavior. This makes the code more maintainable, testable, and easier to extend.

Examples:

Basic usage

status = Status.new
status.enabled        #=> Status::Step
status.connection     #=> Status::Step

Check result

result = status.enabled
result.success?       #=> true or false
result.status         #=> :success, :warning, :failure, or :halted
result.details        #=> { ... } or []

Defined Under Namespace

Modules: Checks Classes: Context, Step

Constant Summary collapse

CHECKS =

Registry of all check classes in execution order.

The order matters because checks depend on previous checks in the chain. Independent checks (like pro_subscription) are placed at the end.

{
  enabled: Checks::Enabled,
  connection: Checks::Connection,
  topics: Checks::Topics,
  partitions: Checks::Partitions,
  replication: Checks::Replication,
  initial_consumers_state: Checks::InitialConsumersState,
  initial_consumers_metrics: Checks::InitialConsumersMetrics,
  consumers_reports: Checks::ConsumersReports,
  live_reporting: Checks::LiveReporting,
  consumers_schemas: Checks::ConsumersSchemas,
  materializing_lag: Checks::MaterializingLag,
  state_calculation: Checks::StateCalculation,
  consumers_reports_schema_state: Checks::ConsumersReportsSchemaState,
  routing_topics_presence: Checks::RoutingTopicsPresence,
  commands_topic_presence: Checks::CommandsTopicPresence,
  pro_subscription: Checks::ProSubscription
}.freeze

Instance Method Summary collapse

Constructor Details

#initializeStatus

Initializes a new Status instance.

Creates a shared context for all checks and initializes the results cache.



64
65
66
67
# File 'lib/karafka/web/ui/models/status.rb', line 64

def initialize
  @context = Context.new
  @results = {}
end