#NEWLINE# def test_custom_single_percentile( self ) : #NEWLINE# #INDENT# configstr = '0.40' #NEWLINE# stats = MetricsAggregator ( 'myhost' , histogram_percentiles = get_histogram_percentiles ( stats ) ) #NEWLINE# self . assertEquals ( stats . metric_config [ Histogram ] [ 'percentiles' ] , [ 0.4 ] , stats . metric_config [ Histogram ] ) #NEWLINE# for i in xrange ( 20 ) : #NEWLINE# #INDENT# stats . submit_packets ( 'myhistogram:{0}|h' . format ( i ) ) #NEWLINE# #UNINDENT# metrics = stats . flush ( ) #NEWLINE# self . assertEquals ( len ( metrics ) , 5 , metrics ) #NEWLINE# value_by_type = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for k in metrics : #NEWLINE# #INDENT# value_by_type [ k [ 'metric' ] [ ( len ( 'myhistogram' ) + 1 ) : ] ] = k [ 'points' ] [ 0 ] [ 1 ] #NEWLINE# #UNINDENT# self . assertEquals ( value_by_type [ '40percentile' ] , 7 , value_by_type )