def run(self): """Begins executing the monitor, writing metric output to self._logger.""" tcollector.override_logging(self._logger) tcollector.reset_for_new_run() # At this point we're ready to start processing, so start the ReaderThread # so we can have it running and pulling in data from reading the stdins of all the collectors # that will be soon running. reader = ReaderThread(0, 300, self._run_state) reader.start() # Start the writer thread that grabs lines off of the reader thread's queue and emits # them to the log. writer = WriterThread(self, reader.readerq, self._logger, self._logger) writer.start() # Now run the main loop which will constantly watch the collector module files, reloading / spawning # collectors as necessary. This should only terminate once is_stopped becomes true. tcollector.main_loop(self.options, self.modules, None, self.tags, False, self._run_state) self._logger.debug('Shutting down') tcollector.shutdown(invoke_exit=False) writer.stop(wait_on_join=False) self._logger.debug('Shutting down -- joining the reader thread.') reader.join(1) self._logger.debug('Shutting down -- joining the writer thread.') writer.stop(join_timeout=1)
def run(self): """Begins executing the monitor, writing metric output to self._logger.""" tcollector.override_logging(self._logger) tcollector.reset_for_new_run() # At this point we're ready to start processing, so start the ReaderThread # so we can have it running and pulling in data from reading the stdins of all the collectors # that will be soon running. reader = ReaderThread(0, 300, self._run_state) reader.start() # Start the writer thread that grabs lines off of the reader thread's queue and emits # them to the log. writer = WriterThread(self, reader.readerq, self._logger, self._logger) writer.start() # Now run the main loop which will constantly watch the collector module files, reloading / spawning # collectors as necessary. This should only terminate once is_stopped becomes true. tcollector.main_loop(self.options, self.modules, None, self.tags, False, self._run_state, self._sample_interval_secs) self._logger.debug('Shutting down') tcollector.shutdown(invoke_exit=False) writer.stop(wait_on_join=False) self._logger.debug('Shutting down -- joining the reader thread.') reader.join(1) self._logger.debug('Shutting down -- joining the writer thread.') writer.stop(join_timeout=1)