Skip to content

Commit 75ed480

Browse files
dd
1 parent 8730fb6 commit 75ed480

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

test/e2e/metrics_test.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (c *MetricsTestConfig) fetchMetrics(ctx context.Context, token string) map[
123123
func 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

Comments
 (0)