class Karafka::Instrumentation::Monitor
per running process (just as logger)
@note This class acts as a singleton because we are only permitted to have single monitor
time
same time, which means that you might have for example file logging and newrelic at the same
Since it is a pub-sub based on dry-monitor, you can use as many subscribers/loggers at the
It provides a standardized API for checking incoming messages/enqueueing etc
Monitor is used to hookup external monitoring services to monitor how Karafka works
def available_events
-
(Array
- names of available events to which we can subscribe)
def available_events __bus__.events.keys end
def initialize
-
(Karafka::Instrumentation::Monitor)
- monitor instance for system instrumentation
def initialize super(:karafka) BASE_EVENTS.each(&method(:register_event)) end
def subscribe(event_name_or_listener)
-
event_name_or_listener
(String, Object
) -- name of the event we want to subscribe to
def subscribe(event_name_or_listener) return super unless event_name_or_listener.is_a?(String) return super if available_events.include?(event_name_or_listener) raise Errors::UnregisteredMonitorEvent, event_name_or_listener end