grr/server/grr_response_server/stats_store.py
def _RunLoop(self):
    """Periodically dumps metric values for the current process to the db."""
    # Sleep for a random fraction of the write-interval, so that writes for
    # all GRR processes are more spread-out.
    max_jitter_secs = _STATS_WRITE_INTERVAL_JITTER * self._write_interval_secs
    time.sleep(random.uniform(0, max_jitter_secs))
    while True:
      try:
        _WriteStats(process_id=self.process_id)
        # We use a cronjob to delete stats from the relational DB.
        if not _ShouldUseRelationalDB():
          _DeleteStatsFromLegacyDB(self.process_id)
      except Exception as e:  # pylint: disable=broad-except
        # Log all exceptions and continue, since we do not want transient
        # errors to halt stats-processing.
        # TODO(user): Add monitoring for these exceptions.
        logging.exception("Encountered an error while writing stats: %s", e)

      time.sleep(self._write_interval_secs)
Periodically dumps metric values for the current process to the db.
Periodically dumps metric values for the current process to the db.
Periodically dumps metric values for the current process to the db .
def _RunLoop(self):
    max_jitter_secs = _STATS_WRITE_INTERVAL_JITTER * self._write_interval_secs
    time.sleep(random.uniform(0, max_jitter_secs))
    while True:
      try:
        _WriteStats(process_id=self.process_id)
        if not _ShouldUseRelationalDB():
          _DeleteStatsFromLegacyDB(self.process_id)
      except Exception as e:  
        logging.exception("Encountered an error while writing stats: %s", e)
      time.sleep(self._write_interval_secs)
def _RunLoop ( self ) : max_jitter_secs = _STATS_WRITE_INTERVAL_JITTER * self . _write_interval_secs time . sleep ( random . uniform ( 0 , max_jitter_secs ) ) while True : try : _WriteStats ( process_id = self . process_id ) if not _ShouldUseRelationalDB ( ) : _DeleteStatsFromLegacyDB ( self . process_id ) except Exception as e : logging . exception ( "Encountered an error while writing stats: %s" , e ) time . sleep ( self . _write_interval_secs )
Periodically dumps metric values for the current process to the db.
Periodically dumps metric values for the current process to the db .
"""Periodically dumps metric values for the current process to the db.""" # Sleep for a random fraction of the write-interval, so that writes for # all GRR processes are more spread-out. # We use a cronjob to delete stats from the relational DB. # pylint: disable=broad-except # Log all exceptions and continue, since we do not want transient # errors to halt stats-processing. # TODO(user): Add monitoring for these exceptions.
self