#NEWLINE# def status( self , args ) : #NEWLINE# #INDENT# response = self . _status ( ) #NEWLINE# metrics = response [ 'metrics' ] #NEWLINE# print ( '{:<28} {:<8} {:<26} {:10} {}' . format ( 'METRIC' , 'TYPE' , 'NAME' , 'VALUE' , 'AVERAGE' ) ) #NEWLINE# for metric in [ m for m in metrics if ( m [ 'type' ] in [ 'gauge' , 'counter' , 'timer' ] ) ] : #NEWLINE# #INDENT# if ( metric [ 'type' ] == 'gauge' ) : #NEWLINE# #INDENT# print ( '{0:<28} {1:<8} {2:<26} {3:<10}' . format ( metric [ 'title' ] , metric [ 'type' ] , ( ( metric [ 'group' ] + '.' ) + metric [ 'name' ] ) , metric [ 'value' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( metric [ 'type' ] == 'counter' ) : #NEWLINE# #INDENT# print ( '{0:<28} {1:<8} {2:<26} {3:<10}' . format ( metric [ 'title' ] , metric [ 'type' ] , ( ( metric [ 'group' ] + '.' ) + metric [ 'name' ] ) , metric [ 'count' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( metric [ 'type' ] == 'timer' ) : #NEWLINE# #INDENT# value = metric . get ( 'count' , 0 ) #NEWLINE# avg = ( ( int ( metric [ 'totalTime' ] ) * 1.0 ) / int ( metric [ 'count' ] ) ) #NEWLINE# print ( '{0:<28} {1:<8} {2:<26} {3:<10} {4:-3.2f} ms' . format ( metric [ 'title' ] , metric [ 'type' ] , ( ( metric [ 'group' ] + '.' ) + metric [ 'name' ] ) , value , avg ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for metric in [ m for m in metrics if ( m [ 'type' ] == 'text' ) ] : #NEWLINE# #INDENT# print ( '{0:<28} {1:<8} {2:<26} {3:<10}' . format ( metric [ 'title' ] , metric [ 'type' ] , ( ( metric [ 'group' ] + '.' ) + metric [ 'name' ] ) , metric [ 'value' ] ) )