#NEWLINE# def FilterRecords( self , recordlist , recording_starttime ) : #NEWLINE# #INDENT# 'Returns subset of records that meet filtering crtieria.\n\n    While navigating the tool, developers may wish to focus on a certain\n    subset of records that meet desired filters. Currently, the supported\n    filters are (i) by time of recording; and (ii) request latency. Filter\n    information is parsed from request arguments.\n\n    Args:\n      recordlist: List of raw appstats records over which filtering condition\n        must be applied.\n      recording_starttime: Timestamp when recording of data starts expressed\n        in seconds. This is the timestamp of the earliest recorded Appstats\n        data.\n    Returns:\n      Subset of records that meet the filtering criteria\n    ' #NEWLINE# url = self . request . get ( 'url' ) #NEWLINE# latency_lower = self . request . get ( 'latency_lower' ) #NEWLINE# latency_upper = self . request . get ( 'latency_upper' ) #NEWLINE# starttime = self . request . get ( 'starttime' ) #NEWLINE# endtime = self . request . get ( 'endtime' ) #NEWLINE# filter_condition = Filter ( url = url , starttime = starttime , endtime = endtime , latency_lower = latency_lower , latency_upper = latency_upper ) #NEWLINE# filtered_records = [ ] #NEWLINE# for record in recordlist : #NEWLINE# #INDENT# path_key = recording . config . extract_key ( record ) #NEWLINE# reltime = int ( ( ( record . start_timestamp_milliseconds ( ) * 0.001 ) - recording_starttime ) ) #NEWLINE# latency = record . duration_milliseconds ( ) #NEWLINE# ismatch = filter_condition . Match ( path_key , reltime , latency ) #NEWLINE# if ismatch : #NEWLINE# #INDENT# filtered_records . append ( record ) #NEWLINE# #UNINDENT# #UNINDENT# logging . info ( 'Original number of records: %d' , len ( recordlist ) ) #NEWLINE# logging . info ( 'After filtering: number of records: %d' , len ( filtered_records ) ) #NEWLINE# return ( filter_condition , filtered_records )