#NEWLINE# def flush( self ) : #NEWLINE# #INDENT# if self . logger . isEnabledFor ( logging . DEBUG ) : #NEWLINE# #INDENT# self . logger . debug ( 'Aggregating data...' ) #NEWLINE# for metric in self . metrics_queue : #NEWLINE# #INDENT# self . logger . debug ( ( 'Metric: %s' % repr ( self ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# data = self . _fold_metrics ( self . metrics_queue ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . logger . exception ( 'Failed to fold metrics data' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if data : #NEWLINE# #INDENT# self . metrics_store . flush ( data ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# self . logger . exception ( 'Failed to flush data' ) #NEWLINE# #UNINDENT# self . logger . debug ( 'Aggregation complete.' )