#NEWLINE# def _get_aggregate_metrics( self , flush_time = None ) : #NEWLINE# #INDENT# '\n        Get, format and return the rolled up metrics from the aggregator.\n        ' #NEWLINE# rolled_up_metrics = self . _metric_aggregator . flush ( flush_time ) #NEWLINE# metrics = [ ] #NEWLINE# for ( timestamp , value , name , tags , host ) in rolled_up_metrics : #NEWLINE# #INDENT# metric_tags = tags #NEWLINE# metric_name = name #NEWLINE# if self . constant_tags : #NEWLINE# #INDENT# if tags : #NEWLINE# #INDENT# metric_tags = ( tags + metric . constant_tags ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# metric_tags = self . constant_tags #NEWLINE# #UNINDENT# #UNINDENT# if self . namespace : #NEWLINE# #INDENT# metric_name = ( ( self . namespace + '.' ) + name ) #NEWLINE# #UNINDENT# metric = { #NEWLINE# #INDENT# 'metric' : metric_name , #NEWLINE# 'points' : [ [ timestamp , value ] ] , #NEWLINE# 'type' : MetricType . Gauge , #NEWLINE# 'host' : host , #NEWLINE# 'device' : self . device , #NEWLINE# 'tags' : metric_tags , #NEWLINE# #UNINDENT# } #NEWLINE# metrics . append ( metric ) #NEWLINE# #UNINDENT# return metrics