Skip to content

Commit ab9d801

Browse files
committed
Go version expected default runtime metrics map for tests
1 parent 20ebd6c commit ab9d801

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2024 The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build !go1.21
15+
// +build !go1.21
16+
17+
package prometheus
18+
19+
var expMetrics = map[string]string{
20+
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
21+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2024 The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build go1.21
15+
// +build go1.21
16+
17+
package prometheus
18+
19+
var expMetrics = map[string]string{
20+
"/gc/gogc:percent": "go_gc_gogc_percent",
21+
"/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
22+
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
23+
}

prometheus/go_collector_latest_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ func addExpectedRuntimeMetrics(metrics map[string]struct{}) map[string]struct{}
7575
}
7676

7777
func addExpectedDefaultRuntimeMetrics(metrics map[string]struct{}) map[string]struct{} {
78-
expMetrics := map[string]string{
79-
"/gc/gogc:percent": "go_gc_gogc_percent",
80-
"/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
81-
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
82-
}
8378
for _, e := range expMetrics {
8479
metrics[e] = struct{}{}
8580
}

0 commit comments

Comments
 (0)