@@ -123,7 +123,7 @@ func (c *MetricsTestConfig) fetchMetrics(ctx context.Context, token string) map[
123123func parseMetrics (metricsText string ) map [string ]float64 {
124124 relevantMetrics := []string {
125125 "controller_runtime_reconcile_time_seconds_sum" ,
126- "catalogd_http_request_duration_seconds_sum " ,
126+ "http_request_duration_seconds_sum " ,
127127 "controller_runtime_reconcile_total" ,
128128 "go_cpu_classes_gc_total_cpu_seconds_total" ,
129129 "go_cpu_classes_idle_cpu_seconds_total" ,
@@ -132,14 +132,20 @@ func parseMetrics(metricsText string) map[string]float64 {
132132 }
133133
134134 mapMetrics := make (map [string ]float64 )
135- for _ , metric := range relevantMetrics {
136- regex := regexp .MustCompile (metric + `\s+([0-9.]+)` )
137- match := regex .FindStringSubmatch (metricsText )
138-
139- if len (match ) == 2 {
140- v , err := strconv .ParseFloat (match [1 ], 64 )
141- if err == nil {
142- mapMetrics [metric ] = v
135+ lines := strings .Split (metricsText , "\n " )
136+ for _ , line := range lines {
137+ // Check for partial matches
138+ for _ , partial := range relevantMetrics {
139+ if strings .Contains (line , partial ) {
140+ re := regexp .MustCompile (`(\S+)\s+([0-9.]+)` )
141+ match := re .FindStringSubmatch (line )
142+ if len (match ) == 3 {
143+ metricName := match [1 ]
144+ value , err := strconv .ParseFloat (match [2 ], 64 )
145+ if err == nil {
146+ mapMetrics [metricName ] = value
147+ }
148+ }
143149 }
144150 }
145151 }
0 commit comments