fix log mangling, make event queue 10x bigger to avoid dropping logs
This commit is contained in:
parent
39d72e71b3
commit
e6aa22dbbb
|
@ -41,7 +41,7 @@ class AlertManager(component.Component):
|
|||
self.session = component.get('Core').session
|
||||
|
||||
# Increase the alert queue size so that alerts don't get lost.
|
||||
self.alert_queue_size = 10000
|
||||
self.alert_queue_size = 1000000
|
||||
self.set_alert_queue_size(self.alert_queue_size)
|
||||
|
||||
alert_mask = (
|
||||
|
|
|
@ -27,6 +27,7 @@ class Metrics:
|
|||
fieldnames=['metric', 'timestamp', 'labels', 'value'],
|
||||
)
|
||||
self.log_writer.writeheader()
|
||||
self._flush_to_log()
|
||||
core.session.post_dht_stats()
|
||||
|
||||
def handle_alert(self, alert):
|
||||
|
@ -57,7 +58,9 @@ class Metrics:
|
|||
'value': alert.piece_index,
|
||||
})
|
||||
)
|
||||
self._flush_to_log()
|
||||
|
||||
def _flush_to_log(self):
|
||||
logger.info(self._buffer.getvalue())
|
||||
self._buffer.truncate(0)
|
||||
self._buffer.seek(0)
|
||||
|
|
Loading…
Reference in New Issue