@@ -522,13 +522,17 @@ func (s *HTTPService) NetworkHTTPEndpointFor(networkName string) string {
522522// WaitSumMetrics waits for at least one instance of each given metric names to be present and their sums, returning true 
523523// when passed to given isExpected(...). 
524524func  (s  * HTTPService ) WaitSumMetrics (isExpected  func (sums  ... float64 ) bool , metricNames  ... string ) error  {
525+ 	return  s .WaitSumMetricsWithOptions (isExpected , metricNames )
526+ }
527+ 
528+ func  (s  * HTTPService ) WaitSumMetricsWithOptions (isExpected  func (sums  ... float64 ) bool , metricNames  []string , opts  ... MetricsOption ) error  {
525529	var  (
526530		sums  []float64 
527531		err   error 
528532	)
529533
530534	for  s .retryBackoff .Reset (); s .retryBackoff .Ongoing (); {
531- 		sums , err  =  s .SumMetrics (metricNames ... )
535+ 		sums , err  =  s .SumMetrics (metricNames ,  opts ... )
532536		if  err  !=  nil  {
533537			return  err 
534538		}
@@ -544,7 +548,8 @@ func (s *HTTPService) WaitSumMetrics(isExpected func(sums ...float64) bool, metr
544548}
545549
546550// SumMetrics returns the sum of the values of each given metric names. 
547- func  (s  * HTTPService ) SumMetrics (metricNames  ... string ) ([]float64 , error ) {
551+ func  (s  * HTTPService ) SumMetrics (metricNames  []string , opts  ... MetricsOption ) ([]float64 , error ) {
552+ 	options  :=  buildMetricsOptions (opts )
548553	sums  :=  make ([]float64 , len (metricNames ))
549554
550555	metrics , err  :=  s .Metrics ()
@@ -563,7 +568,7 @@ func (s *HTTPService) SumMetrics(metricNames ...string) ([]float64, error) {
563568
564569		// Check if the metric is exported. 
565570		if  mf , ok  :=  families [m ]; ok  {
566- 			sums [i ] =  sumValues (mf )
571+ 			sums [i ] =  sumValues (getValues ( mf ,  options . GetValue ) )
567572			continue 
568573		}
569574		return  nil , errors .Errorf ("metric %s not found in %s metric page" , m , s .name )
@@ -582,7 +587,7 @@ func (s *HTTPService) WaitForMetricWithLabels(okFn func(v float64) bool, metricN
582587		}
583588
584589		for  _ , m  :=  range  ms  {
585- 			if  okFn (getValue (m )) {
590+ 			if  okFn (getMetricValue (m )) {
586591				return  nil 
587592			}
588593		}
@@ -602,7 +607,7 @@ func (s *HTTPService) SumMetricWithLabels(metricName string, expectedLabels map[
602607	}
603608
604609	for  _ , m  :=  range  ms  {
605- 		sum  +=  getValue (m )
610+ 		sum  +=  getMetricValue (m )
606611	}
607612	return  sum , nil 
608613}
0 commit comments