Class: Karafka::Web::Management::Migrations::SetInitialConsumersState

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/management/migrations/0_set_initial_consumers_state.rb

Overview

Initial migration that sets the consumers state initial first state. This is the basic of state as they were when they were introduced.

Instance Method Summary collapse

Methods inherited from Base

applicable?, index, migrate, sorted_descendants

Instance Method Details

#migrate(state) ⇒ Object

Parameters:

  • state (Hash)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/karafka/web/management/migrations/0_set_initial_consumers_state.rb', line 15

def migrate(state)
  state.merge!(
    processes: {},
    stats: {
      batches: 0,
      messages: 0,
      retries: 0,
      dead: 0,
      busy: 0,
      enqueued: 0,
      processing: 0,
      workers: 0,
      processes: 0,
      rss: 0,
      listeners: 0,
      utilization: 0,
      errors: 0,
      lag_stored: 0,
      lag: 0
    },
    schema_state: 'accepted',
    dispatched_at: float_now
  )
end