#NEWLINE# def getrec( request_type , name , response_time , response_length , exc = None ) : #NEWLINE# #INDENT# rcode = ( '200' if ( exc is None ) else '500' ) #NEWLINE# rmsg = ( 'OK' if ( exc is None ) else ( '%s' % exc ) ) #NEWLINE# if isinstance ( exc , HTTPError ) : #NEWLINE# #INDENT# rcode = exc . message [ : exc . message . index ( ' ' ) ] #NEWLINE# rmsg = exc . message [ ( exc . message . index ( ':' ) + 2 ) : ] #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'timeStamp' : ( '%d' % ( time . time ( ) * 1000 ) ) , #NEWLINE# 'label' : name , #NEWLINE# 'method' : request_type , #NEWLINE# 'elapsed' : response_time , #NEWLINE# 'bytes' : response_length , #NEWLINE# 'responseCode' : rcode , #NEWLINE# 'responseMessage' : rcode , #NEWLINE# 'success' : ( 'true' if ( exc is None ) else 'false' ) , #NEWLINE# 'allThreads' : ( runners . locust_runner . user_count if runners . locust_runner else 0 ) , #NEWLINE# 'Latency' : 0 , #NEWLINE# #UNINDENT# }