Class: Karafka::Web::Tracking::Consumers::Listeners::Status

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/tracking/consumers/listeners/status.rb

Overview

Listener that triggers reporting on Karafka process status changes Whenever the whole process status changes, we do not want to wait and want to report as fast as possible, hence report!. This improves the user experience and since status changes do not happen that often, we can handle few extra reports dispatches.

Instance Method Summary collapse

Instance Method Details

#on_app_quiet(_event) ⇒ Object

Indicate as fast as possible that we’ve reached the quiet mode

Parameters:

  • _event (Karafka::Core::Monitoring::Event)


31
32
33
# File 'lib/karafka/web/tracking/consumers/listeners/status.rb', line 31

def on_app_quiet(_event)
  report!
end

#on_app_quieting(_event) ⇒ Object

Indicate as fast as possible that we’ve started moving to the quiet mode

Parameters:

  • _event (Karafka::Core::Monitoring::Event)


24
25
26
# File 'lib/karafka/web/tracking/consumers/listeners/status.rb', line 24

def on_app_quieting(_event)
  report!
end

#on_app_stopped(_event) ⇒ Object

Instrument on the fact that Karafka has stopped

We do this actually before the process ends but we need to do this so the UI does not have this “handling” stopping process.

Parameters:

  • _event (Karafka::Core::Monitoring::Event)


49
50
51
52
# File 'lib/karafka/web/tracking/consumers/listeners/status.rb', line 49

def on_app_stopped(_event)
  # Make sure this is sent before shutdown
  report!
end

#on_app_stopping(_event) ⇒ Object

Instrument on the fact that we’re stopping

Parameters:

  • _event (Karafka::Core::Monitoring::Event)


38
39
40
41
# File 'lib/karafka/web/tracking/consumers/listeners/status.rb', line 38

def on_app_stopping(_event)
  # Make sure this is sent before shutdown
  report!
end

#on_connection_listener_before_fetch_loop(_event) ⇒ Object

Note:

We do not use #report! here because this kicks in for each listener loop and those run the same time.

Parameters:

  • _event (Karafka::Core::Monitoring::Event)


17
18
19
# File 'lib/karafka/web/tracking/consumers/listeners/status.rb', line 17

def on_connection_listener_before_fetch_loop(_event)
  report
end