#NEWLINE# @ handler . authenticated ( ) #NEWLINE# @ handler . asynchronous ( datastore = True ) #NEWLINE# @ admin . require_permission ( level = 'support' ) #NEWLINE# @ gen . engine #NEWLINE# def get( self ) : #NEWLINE# #INDENT# metric_name = self . get_argument ( 'metric_name' , kDefaultMetricName ) #NEWLINE# end_time = int ( self . get_argument ( 'end-secs' , time . time ( ) ) ) #NEWLINE# start_time = int ( self . get_argument ( 'start-secs' , ( end_time - constants . SECONDS_PER_WEEK ) ) ) #NEWLINE# selected_interval = metric . LOGS_INTERVALS [ ( - 1 ) ] #NEWLINE# group_key = metric . Metric . EncodeGroupKey ( metric . LOGS_STATS_NAME , selected_interval ) #NEWLINE# logging . info ( ( 'Query performance counters %s, range: %s - %s, resolution: %s' % ( group_key , time . ctime ( start_time ) , time . ctime ( end_time ) , selected_interval . name ) ) ) #NEWLINE# metrics = list ( ) #NEWLINE# start_key = None #NEWLINE# while True : #NEWLINE# #INDENT# new_metrics = ( yield gen . Task ( metric . Metric . QueryTimespan , self . _client , group_key , start_time , end_time , excl_start_key = start_time ) ) #NEWLINE# if ( len ( new_metrics ) > 0 ) : #NEWLINE# #INDENT# metrics . extend ( new_metrics ) #NEWLINE# start_key = metrics [ ( - 1 ) ] . GetKey ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# ( columns , data ) = _SerializeMetrics ( metrics , metric_name ) #NEWLINE# t_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# t_dict . update ( self . PermissionsTemplateDict ( ) ) #NEWLINE# t_dict [ 'col_names' ] = columns #NEWLINE# t_dict [ 'col_data' ] = data #NEWLINE# t_dict [ 'metric_name' ] = metric_name #NEWLINE# t_dict [ 'start_secs' ] = start_time #NEWLINE# t_dict [ 'end_secs' ] = end_time #NEWLINE# self . render ( 'metrics_table.html' , ** t_dict )