@@ -128,21 +128,19 @@ func rm2prom(d metrics.Description) string {
128128func groupMetrics (metricsList []string ) []metricGroup {
129129 var groupedMetrics []metricGroup
130130 for _ , group := range metricGroups {
131- var matchedMetrics []string
131+ matchedMetrics := make ( []string , 0 )
132132 for _ , metric := range metricsList {
133133 if group .Regex == nil || group .Regex .MatchString (metric ) {
134134 matchedMetrics = append (matchedMetrics , metric )
135135 }
136136 }
137137
138138 sort .Strings (matchedMetrics )
139- if len (matchedMetrics ) > 0 {
140- groupedMetrics = append (groupedMetrics , metricGroup {
141- Name : group .Name ,
142- Regex : group .Regex ,
143- Metrics : matchedMetrics ,
144- })
145- }
139+ groupedMetrics = append (groupedMetrics , metricGroup {
140+ Name : group .Name ,
141+ Regex : group .Regex ,
142+ Metrics : matchedMetrics ,
143+ })
146144 }
147145 return groupedMetrics
148146}
@@ -161,6 +159,9 @@ var testFile = template.Must(template.New("testFile").Funcs(map[string]interface
161159 "nextVersion" : func (version goVersion ) string {
162160 return (version + goVersion (1 )).String ()
163161 },
162+ "needsBaseMetrics" : func (groupName string ) bool {
163+ return groupName == "withAllMetrics" || groupName == "withGCMetrics" || groupName == "withMemoryMetrics" || groupName == "withDebugMetrics"
164+ },
164165}).Parse (`// Copyright 2022 The Prometheus Authors
165166// Licensed under the Apache License, Version 2.0 (the "License");
166167// you may not use this file except in compliance with the License.
0 commit comments