Addressed comments on Arianna's PR.

Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
bwplotka 2024-08-09 11:14:57 +01:00
parent b8a9eb7b75
commit 23879d69c3
8 changed files with 264 additions and 261 deletions

View File

@ -63,16 +63,29 @@ func main() {
v := goVersion(gv.Segments()[1]) v := goVersion(gv.Segments()[1])
log.Printf("generating metrics for Go version %q", v) log.Printf("generating metrics for Go version %q", v)
allDesc := metrics.All()
// Find default metrics.
var defaultDesc []metrics.Description
for _, d := range allDesc {
if !internal.GoCollectorDefaultRuntimeMetrics.MatchString(d.Name) {
continue
}
defaultDesc = append(defaultDesc, d)
}
// Generate code. // Generate code.
var buf bytes.Buffer var buf bytes.Buffer
err = testFile.Execute(&buf, struct { err = testFile.Execute(&buf, struct {
Descriptions []metrics.Description AllDescriptions []metrics.Description
GoVersion goVersion DefaultDescriptions []metrics.Description
Cardinality int GoVersion goVersion
Cardinality int
}{ }{
Descriptions: metrics.All(), AllDescriptions: allDesc,
GoVersion: v, DefaultDescriptions: defaultDesc,
Cardinality: rmCardinality(), GoVersion: v,
Cardinality: rmCardinality(),
}) })
if err != nil { if err != nil {
log.Fatalf("executing template: %v", err) log.Fatalf("executing template: %v", err)
@ -167,14 +180,25 @@ var testFile = template.Must(template.New("testFile").Funcs(map[string]interface
package prometheus package prometheus
var expectedRuntimeMetrics = map[string]string{ var (
{{- range .Descriptions -}} expectedRuntimeMetrics = map[string]string{
{{- range .AllDescriptions -}}
{{- $trans := rm2prom . -}} {{- $trans := rm2prom . -}}
{{- if ne $trans "" }} {{- if ne $trans "" }}
{{.Name | printf "%q"}}: {{$trans | printf "%q"}}, {{.Name | printf "%q"}}: {{$trans | printf "%q"}},
{{- end -}} {{- end -}}
{{end}} {{end}}
} }
expMetrics = map[string]string{
{{- range .DefaultDescriptions -}}
{{- $trans := rm2prom . -}}
{{- if ne $trans "" }}
{{.Name | printf "%q"}}: {{$trans | printf "%q"}},
{{- end -}}
{{end}}
}
)
const expectedRuntimeMetricsCardinality = {{.Cardinality}} const expectedRuntimeMetricsCardinality = {{.Cardinality}}
`)) `))

View File

@ -19,7 +19,6 @@ package prometheus
import ( import (
"fmt" "fmt"
"math" "math"
"regexp"
"runtime" "runtime"
"runtime/metrics" "runtime/metrics"
"strings" "strings"
@ -155,9 +154,8 @@ func defaultGoCollectorOptions() internal.GoCollectorOptions {
"/gc/heap/frees-by-size:bytes": goGCHeapFreesBytes, "/gc/heap/frees-by-size:bytes": goGCHeapFreesBytes,
}, },
RuntimeMetricRules: []internal.GoCollectorRule{ RuntimeMetricRules: []internal.GoCollectorRule{
{ // Recommended metrics we want by default from runtime/metrics.
Matcher: regexp.MustCompile(`\/gc\/gogc:percent|\/gc\/gomemlimit:bytes|\/sched\/gomaxprocs:threads`), {Matcher: internal.GoCollectorDefaultRuntimeMetrics},
},
}, },
} }
} }

View File

@ -1,21 +0,0 @@
// Copyright 2024 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !go1.21
// +build !go1.21
package prometheus
var expMetrics = map[string]string{
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
}

View File

@ -1,23 +0,0 @@
// Copyright 2024 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build go1.21
// +build go1.21
package prometheus
var expMetrics = map[string]string{
"/gc/gogc:percent": "go_gc_gogc_percent",
"/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
}

View File

@ -6,52 +6,58 @@
package prometheus package prometheus
var expectedRuntimeMetrics = map[string]string{ var (
"/cgo/go-to-c-calls:calls": "go_cgo_go_to_c_calls_calls_total", expectedRuntimeMetrics = map[string]string{
"/cpu/classes/gc/mark/assist:cpu-seconds": "go_cpu_classes_gc_mark_assist_cpu_seconds_total", "/cgo/go-to-c-calls:calls": "go_cgo_go_to_c_calls_calls_total",
"/cpu/classes/gc/mark/dedicated:cpu-seconds": "go_cpu_classes_gc_mark_dedicated_cpu_seconds_total", "/cpu/classes/gc/mark/assist:cpu-seconds": "go_cpu_classes_gc_mark_assist_cpu_seconds_total",
"/cpu/classes/gc/mark/idle:cpu-seconds": "go_cpu_classes_gc_mark_idle_cpu_seconds_total", "/cpu/classes/gc/mark/dedicated:cpu-seconds": "go_cpu_classes_gc_mark_dedicated_cpu_seconds_total",
"/cpu/classes/gc/pause:cpu-seconds": "go_cpu_classes_gc_pause_cpu_seconds_total", "/cpu/classes/gc/mark/idle:cpu-seconds": "go_cpu_classes_gc_mark_idle_cpu_seconds_total",
"/cpu/classes/gc/total:cpu-seconds": "go_cpu_classes_gc_total_cpu_seconds_total", "/cpu/classes/gc/pause:cpu-seconds": "go_cpu_classes_gc_pause_cpu_seconds_total",
"/cpu/classes/idle:cpu-seconds": "go_cpu_classes_idle_cpu_seconds_total", "/cpu/classes/gc/total:cpu-seconds": "go_cpu_classes_gc_total_cpu_seconds_total",
"/cpu/classes/scavenge/assist:cpu-seconds": "go_cpu_classes_scavenge_assist_cpu_seconds_total", "/cpu/classes/idle:cpu-seconds": "go_cpu_classes_idle_cpu_seconds_total",
"/cpu/classes/scavenge/background:cpu-seconds": "go_cpu_classes_scavenge_background_cpu_seconds_total", "/cpu/classes/scavenge/assist:cpu-seconds": "go_cpu_classes_scavenge_assist_cpu_seconds_total",
"/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total", "/cpu/classes/scavenge/background:cpu-seconds": "go_cpu_classes_scavenge_background_cpu_seconds_total",
"/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total", "/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total",
"/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total", "/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total",
"/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total", "/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total",
"/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total", "/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total",
"/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total", "/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total",
"/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes", "/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total",
"/gc/heap/allocs:bytes": "go_gc_heap_allocs_bytes_total", "/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes",
"/gc/heap/allocs:objects": "go_gc_heap_allocs_objects_total", "/gc/heap/allocs:bytes": "go_gc_heap_allocs_bytes_total",
"/gc/heap/frees-by-size:bytes": "go_gc_heap_frees_by_size_bytes", "/gc/heap/allocs:objects": "go_gc_heap_allocs_objects_total",
"/gc/heap/frees:bytes": "go_gc_heap_frees_bytes_total", "/gc/heap/frees-by-size:bytes": "go_gc_heap_frees_by_size_bytes",
"/gc/heap/frees:objects": "go_gc_heap_frees_objects_total", "/gc/heap/frees:bytes": "go_gc_heap_frees_bytes_total",
"/gc/heap/goal:bytes": "go_gc_heap_goal_bytes", "/gc/heap/frees:objects": "go_gc_heap_frees_objects_total",
"/gc/heap/objects:objects": "go_gc_heap_objects_objects", "/gc/heap/goal:bytes": "go_gc_heap_goal_bytes",
"/gc/heap/tiny/allocs:objects": "go_gc_heap_tiny_allocs_objects_total", "/gc/heap/objects:objects": "go_gc_heap_objects_objects",
"/gc/limiter/last-enabled:gc-cycle": "go_gc_limiter_last_enabled_gc_cycle", "/gc/heap/tiny/allocs:objects": "go_gc_heap_tiny_allocs_objects_total",
"/gc/pauses:seconds": "go_gc_pauses_seconds", "/gc/limiter/last-enabled:gc-cycle": "go_gc_limiter_last_enabled_gc_cycle",
"/gc/stack/starting-size:bytes": "go_gc_stack_starting_size_bytes", "/gc/pauses:seconds": "go_gc_pauses_seconds",
"/memory/classes/heap/free:bytes": "go_memory_classes_heap_free_bytes", "/gc/stack/starting-size:bytes": "go_gc_stack_starting_size_bytes",
"/memory/classes/heap/objects:bytes": "go_memory_classes_heap_objects_bytes", "/memory/classes/heap/free:bytes": "go_memory_classes_heap_free_bytes",
"/memory/classes/heap/released:bytes": "go_memory_classes_heap_released_bytes", "/memory/classes/heap/objects:bytes": "go_memory_classes_heap_objects_bytes",
"/memory/classes/heap/stacks:bytes": "go_memory_classes_heap_stacks_bytes", "/memory/classes/heap/released:bytes": "go_memory_classes_heap_released_bytes",
"/memory/classes/heap/unused:bytes": "go_memory_classes_heap_unused_bytes", "/memory/classes/heap/stacks:bytes": "go_memory_classes_heap_stacks_bytes",
"/memory/classes/metadata/mcache/free:bytes": "go_memory_classes_metadata_mcache_free_bytes", "/memory/classes/heap/unused:bytes": "go_memory_classes_heap_unused_bytes",
"/memory/classes/metadata/mcache/inuse:bytes": "go_memory_classes_metadata_mcache_inuse_bytes", "/memory/classes/metadata/mcache/free:bytes": "go_memory_classes_metadata_mcache_free_bytes",
"/memory/classes/metadata/mspan/free:bytes": "go_memory_classes_metadata_mspan_free_bytes", "/memory/classes/metadata/mcache/inuse:bytes": "go_memory_classes_metadata_mcache_inuse_bytes",
"/memory/classes/metadata/mspan/inuse:bytes": "go_memory_classes_metadata_mspan_inuse_bytes", "/memory/classes/metadata/mspan/free:bytes": "go_memory_classes_metadata_mspan_free_bytes",
"/memory/classes/metadata/other:bytes": "go_memory_classes_metadata_other_bytes", "/memory/classes/metadata/mspan/inuse:bytes": "go_memory_classes_metadata_mspan_inuse_bytes",
"/memory/classes/os-stacks:bytes": "go_memory_classes_os_stacks_bytes", "/memory/classes/metadata/other:bytes": "go_memory_classes_metadata_other_bytes",
"/memory/classes/other:bytes": "go_memory_classes_other_bytes", "/memory/classes/os-stacks:bytes": "go_memory_classes_os_stacks_bytes",
"/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes", "/memory/classes/other:bytes": "go_memory_classes_other_bytes",
"/memory/classes/total:bytes": "go_memory_classes_total_bytes", "/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes",
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads", "/memory/classes/total:bytes": "go_memory_classes_total_bytes",
"/sched/goroutines:goroutines": "go_sched_goroutines_goroutines", "/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
"/sched/latencies:seconds": "go_sched_latencies_seconds", "/sched/goroutines:goroutines": "go_sched_goroutines_goroutines",
"/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total", "/sched/latencies:seconds": "go_sched_latencies_seconds",
} "/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total",
}
expMetrics = map[string]string{
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
}
)
const expectedRuntimeMetricsCardinality = 89 const expectedRuntimeMetricsCardinality = 89

View File

@ -6,77 +6,86 @@
package prometheus package prometheus
var expectedRuntimeMetrics = map[string]string{ var (
"/cgo/go-to-c-calls:calls": "go_cgo_go_to_c_calls_calls_total", expectedRuntimeMetrics = map[string]string{
"/cpu/classes/gc/mark/assist:cpu-seconds": "go_cpu_classes_gc_mark_assist_cpu_seconds_total", "/cgo/go-to-c-calls:calls": "go_cgo_go_to_c_calls_calls_total",
"/cpu/classes/gc/mark/dedicated:cpu-seconds": "go_cpu_classes_gc_mark_dedicated_cpu_seconds_total", "/cpu/classes/gc/mark/assist:cpu-seconds": "go_cpu_classes_gc_mark_assist_cpu_seconds_total",
"/cpu/classes/gc/mark/idle:cpu-seconds": "go_cpu_classes_gc_mark_idle_cpu_seconds_total", "/cpu/classes/gc/mark/dedicated:cpu-seconds": "go_cpu_classes_gc_mark_dedicated_cpu_seconds_total",
"/cpu/classes/gc/pause:cpu-seconds": "go_cpu_classes_gc_pause_cpu_seconds_total", "/cpu/classes/gc/mark/idle:cpu-seconds": "go_cpu_classes_gc_mark_idle_cpu_seconds_total",
"/cpu/classes/gc/total:cpu-seconds": "go_cpu_classes_gc_total_cpu_seconds_total", "/cpu/classes/gc/pause:cpu-seconds": "go_cpu_classes_gc_pause_cpu_seconds_total",
"/cpu/classes/idle:cpu-seconds": "go_cpu_classes_idle_cpu_seconds_total", "/cpu/classes/gc/total:cpu-seconds": "go_cpu_classes_gc_total_cpu_seconds_total",
"/cpu/classes/scavenge/assist:cpu-seconds": "go_cpu_classes_scavenge_assist_cpu_seconds_total", "/cpu/classes/idle:cpu-seconds": "go_cpu_classes_idle_cpu_seconds_total",
"/cpu/classes/scavenge/background:cpu-seconds": "go_cpu_classes_scavenge_background_cpu_seconds_total", "/cpu/classes/scavenge/assist:cpu-seconds": "go_cpu_classes_scavenge_assist_cpu_seconds_total",
"/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total", "/cpu/classes/scavenge/background:cpu-seconds": "go_cpu_classes_scavenge_background_cpu_seconds_total",
"/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total", "/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total",
"/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total", "/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total",
"/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total", "/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total",
"/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total", "/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total",
"/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total", "/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total",
"/gc/gogc:percent": "go_gc_gogc_percent", "/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total",
"/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes", "/gc/gogc:percent": "go_gc_gogc_percent",
"/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes", "/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
"/gc/heap/allocs:bytes": "go_gc_heap_allocs_bytes_total", "/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes",
"/gc/heap/allocs:objects": "go_gc_heap_allocs_objects_total", "/gc/heap/allocs:bytes": "go_gc_heap_allocs_bytes_total",
"/gc/heap/frees-by-size:bytes": "go_gc_heap_frees_by_size_bytes", "/gc/heap/allocs:objects": "go_gc_heap_allocs_objects_total",
"/gc/heap/frees:bytes": "go_gc_heap_frees_bytes_total", "/gc/heap/frees-by-size:bytes": "go_gc_heap_frees_by_size_bytes",
"/gc/heap/frees:objects": "go_gc_heap_frees_objects_total", "/gc/heap/frees:bytes": "go_gc_heap_frees_bytes_total",
"/gc/heap/goal:bytes": "go_gc_heap_goal_bytes", "/gc/heap/frees:objects": "go_gc_heap_frees_objects_total",
"/gc/heap/live:bytes": "go_gc_heap_live_bytes", "/gc/heap/goal:bytes": "go_gc_heap_goal_bytes",
"/gc/heap/objects:objects": "go_gc_heap_objects_objects", "/gc/heap/live:bytes": "go_gc_heap_live_bytes",
"/gc/heap/tiny/allocs:objects": "go_gc_heap_tiny_allocs_objects_total", "/gc/heap/objects:objects": "go_gc_heap_objects_objects",
"/gc/limiter/last-enabled:gc-cycle": "go_gc_limiter_last_enabled_gc_cycle", "/gc/heap/tiny/allocs:objects": "go_gc_heap_tiny_allocs_objects_total",
"/gc/pauses:seconds": "go_gc_pauses_seconds", "/gc/limiter/last-enabled:gc-cycle": "go_gc_limiter_last_enabled_gc_cycle",
"/gc/scan/globals:bytes": "go_gc_scan_globals_bytes", "/gc/pauses:seconds": "go_gc_pauses_seconds",
"/gc/scan/heap:bytes": "go_gc_scan_heap_bytes", "/gc/scan/globals:bytes": "go_gc_scan_globals_bytes",
"/gc/scan/stack:bytes": "go_gc_scan_stack_bytes", "/gc/scan/heap:bytes": "go_gc_scan_heap_bytes",
"/gc/scan/total:bytes": "go_gc_scan_total_bytes", "/gc/scan/stack:bytes": "go_gc_scan_stack_bytes",
"/gc/stack/starting-size:bytes": "go_gc_stack_starting_size_bytes", "/gc/scan/total:bytes": "go_gc_scan_total_bytes",
"/godebug/non-default-behavior/execerrdot:events": "go_godebug_non_default_behavior_execerrdot_events_total", "/gc/stack/starting-size:bytes": "go_gc_stack_starting_size_bytes",
"/godebug/non-default-behavior/gocachehash:events": "go_godebug_non_default_behavior_gocachehash_events_total", "/godebug/non-default-behavior/execerrdot:events": "go_godebug_non_default_behavior_execerrdot_events_total",
"/godebug/non-default-behavior/gocachetest:events": "go_godebug_non_default_behavior_gocachetest_events_total", "/godebug/non-default-behavior/gocachehash:events": "go_godebug_non_default_behavior_gocachehash_events_total",
"/godebug/non-default-behavior/gocacheverify:events": "go_godebug_non_default_behavior_gocacheverify_events_total", "/godebug/non-default-behavior/gocachetest:events": "go_godebug_non_default_behavior_gocachetest_events_total",
"/godebug/non-default-behavior/http2client:events": "go_godebug_non_default_behavior_http2client_events_total", "/godebug/non-default-behavior/gocacheverify:events": "go_godebug_non_default_behavior_gocacheverify_events_total",
"/godebug/non-default-behavior/http2server:events": "go_godebug_non_default_behavior_http2server_events_total", "/godebug/non-default-behavior/http2client:events": "go_godebug_non_default_behavior_http2client_events_total",
"/godebug/non-default-behavior/installgoroot:events": "go_godebug_non_default_behavior_installgoroot_events_total", "/godebug/non-default-behavior/http2server:events": "go_godebug_non_default_behavior_http2server_events_total",
"/godebug/non-default-behavior/jstmpllitinterp:events": "go_godebug_non_default_behavior_jstmpllitinterp_events_total", "/godebug/non-default-behavior/installgoroot:events": "go_godebug_non_default_behavior_installgoroot_events_total",
"/godebug/non-default-behavior/multipartmaxheaders:events": "go_godebug_non_default_behavior_multipartmaxheaders_events_total", "/godebug/non-default-behavior/jstmpllitinterp:events": "go_godebug_non_default_behavior_jstmpllitinterp_events_total",
"/godebug/non-default-behavior/multipartmaxparts:events": "go_godebug_non_default_behavior_multipartmaxparts_events_total", "/godebug/non-default-behavior/multipartmaxheaders:events": "go_godebug_non_default_behavior_multipartmaxheaders_events_total",
"/godebug/non-default-behavior/multipathtcp:events": "go_godebug_non_default_behavior_multipathtcp_events_total", "/godebug/non-default-behavior/multipartmaxparts:events": "go_godebug_non_default_behavior_multipartmaxparts_events_total",
"/godebug/non-default-behavior/panicnil:events": "go_godebug_non_default_behavior_panicnil_events_total", "/godebug/non-default-behavior/multipathtcp:events": "go_godebug_non_default_behavior_multipathtcp_events_total",
"/godebug/non-default-behavior/randautoseed:events": "go_godebug_non_default_behavior_randautoseed_events_total", "/godebug/non-default-behavior/netedns0:events": "go_godebug_non_default_behavior_netedns0_events_total",
"/godebug/non-default-behavior/tarinsecurepath:events": "go_godebug_non_default_behavior_tarinsecurepath_events_total", "/godebug/non-default-behavior/panicnil:events": "go_godebug_non_default_behavior_panicnil_events_total",
"/godebug/non-default-behavior/tlsmaxrsasize:events": "go_godebug_non_default_behavior_tlsmaxrsasize_events_total", "/godebug/non-default-behavior/randautoseed:events": "go_godebug_non_default_behavior_randautoseed_events_total",
"/godebug/non-default-behavior/x509sha1:events": "go_godebug_non_default_behavior_x509sha1_events_total", "/godebug/non-default-behavior/tarinsecurepath:events": "go_godebug_non_default_behavior_tarinsecurepath_events_total",
"/godebug/non-default-behavior/x509usefallbackroots:events": "go_godebug_non_default_behavior_x509usefallbackroots_events_total", "/godebug/non-default-behavior/tlsmaxrsasize:events": "go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
"/godebug/non-default-behavior/zipinsecurepath:events": "go_godebug_non_default_behavior_zipinsecurepath_events_total", "/godebug/non-default-behavior/x509sha1:events": "go_godebug_non_default_behavior_x509sha1_events_total",
"/memory/classes/heap/free:bytes": "go_memory_classes_heap_free_bytes", "/godebug/non-default-behavior/x509usefallbackroots:events": "go_godebug_non_default_behavior_x509usefallbackroots_events_total",
"/memory/classes/heap/objects:bytes": "go_memory_classes_heap_objects_bytes", "/godebug/non-default-behavior/zipinsecurepath:events": "go_godebug_non_default_behavior_zipinsecurepath_events_total",
"/memory/classes/heap/released:bytes": "go_memory_classes_heap_released_bytes", "/memory/classes/heap/free:bytes": "go_memory_classes_heap_free_bytes",
"/memory/classes/heap/stacks:bytes": "go_memory_classes_heap_stacks_bytes", "/memory/classes/heap/objects:bytes": "go_memory_classes_heap_objects_bytes",
"/memory/classes/heap/unused:bytes": "go_memory_classes_heap_unused_bytes", "/memory/classes/heap/released:bytes": "go_memory_classes_heap_released_bytes",
"/memory/classes/metadata/mcache/free:bytes": "go_memory_classes_metadata_mcache_free_bytes", "/memory/classes/heap/stacks:bytes": "go_memory_classes_heap_stacks_bytes",
"/memory/classes/metadata/mcache/inuse:bytes": "go_memory_classes_metadata_mcache_inuse_bytes", "/memory/classes/heap/unused:bytes": "go_memory_classes_heap_unused_bytes",
"/memory/classes/metadata/mspan/free:bytes": "go_memory_classes_metadata_mspan_free_bytes", "/memory/classes/metadata/mcache/free:bytes": "go_memory_classes_metadata_mcache_free_bytes",
"/memory/classes/metadata/mspan/inuse:bytes": "go_memory_classes_metadata_mspan_inuse_bytes", "/memory/classes/metadata/mcache/inuse:bytes": "go_memory_classes_metadata_mcache_inuse_bytes",
"/memory/classes/metadata/other:bytes": "go_memory_classes_metadata_other_bytes", "/memory/classes/metadata/mspan/free:bytes": "go_memory_classes_metadata_mspan_free_bytes",
"/memory/classes/os-stacks:bytes": "go_memory_classes_os_stacks_bytes", "/memory/classes/metadata/mspan/inuse:bytes": "go_memory_classes_metadata_mspan_inuse_bytes",
"/memory/classes/other:bytes": "go_memory_classes_other_bytes", "/memory/classes/metadata/other:bytes": "go_memory_classes_metadata_other_bytes",
"/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes", "/memory/classes/os-stacks:bytes": "go_memory_classes_os_stacks_bytes",
"/memory/classes/total:bytes": "go_memory_classes_total_bytes", "/memory/classes/other:bytes": "go_memory_classes_other_bytes",
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads", "/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes",
"/sched/goroutines:goroutines": "go_sched_goroutines_goroutines", "/memory/classes/total:bytes": "go_memory_classes_total_bytes",
"/sched/latencies:seconds": "go_sched_latencies_seconds", "/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
"/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total", "/sched/goroutines:goroutines": "go_sched_goroutines_goroutines",
} "/sched/latencies:seconds": "go_sched_latencies_seconds",
"/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total",
}
const expectedRuntimeMetricsCardinality = 114 expMetrics = map[string]string{
"/gc/gogc:percent": "go_gc_gogc_percent",
"/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
}
)
const expectedRuntimeMetricsCardinality = 115

View File

@ -6,89 +6,97 @@
package prometheus package prometheus
var expectedRuntimeMetrics = map[string]string{ var (
"/cgo/go-to-c-calls:calls": "go_cgo_go_to_c_calls_calls_total", expectedRuntimeMetrics = map[string]string{
"/cpu/classes/gc/mark/assist:cpu-seconds": "go_cpu_classes_gc_mark_assist_cpu_seconds_total", "/cgo/go-to-c-calls:calls": "go_cgo_go_to_c_calls_calls_total",
"/cpu/classes/gc/mark/dedicated:cpu-seconds": "go_cpu_classes_gc_mark_dedicated_cpu_seconds_total", "/cpu/classes/gc/mark/assist:cpu-seconds": "go_cpu_classes_gc_mark_assist_cpu_seconds_total",
"/cpu/classes/gc/mark/idle:cpu-seconds": "go_cpu_classes_gc_mark_idle_cpu_seconds_total", "/cpu/classes/gc/mark/dedicated:cpu-seconds": "go_cpu_classes_gc_mark_dedicated_cpu_seconds_total",
"/cpu/classes/gc/pause:cpu-seconds": "go_cpu_classes_gc_pause_cpu_seconds_total", "/cpu/classes/gc/mark/idle:cpu-seconds": "go_cpu_classes_gc_mark_idle_cpu_seconds_total",
"/cpu/classes/gc/total:cpu-seconds": "go_cpu_classes_gc_total_cpu_seconds_total", "/cpu/classes/gc/pause:cpu-seconds": "go_cpu_classes_gc_pause_cpu_seconds_total",
"/cpu/classes/idle:cpu-seconds": "go_cpu_classes_idle_cpu_seconds_total", "/cpu/classes/gc/total:cpu-seconds": "go_cpu_classes_gc_total_cpu_seconds_total",
"/cpu/classes/scavenge/assist:cpu-seconds": "go_cpu_classes_scavenge_assist_cpu_seconds_total", "/cpu/classes/idle:cpu-seconds": "go_cpu_classes_idle_cpu_seconds_total",
"/cpu/classes/scavenge/background:cpu-seconds": "go_cpu_classes_scavenge_background_cpu_seconds_total", "/cpu/classes/scavenge/assist:cpu-seconds": "go_cpu_classes_scavenge_assist_cpu_seconds_total",
"/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total", "/cpu/classes/scavenge/background:cpu-seconds": "go_cpu_classes_scavenge_background_cpu_seconds_total",
"/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total", "/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total",
"/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total", "/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total",
"/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total", "/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total",
"/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total", "/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total",
"/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total", "/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total",
"/gc/gogc:percent": "go_gc_gogc_percent", "/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total",
"/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes", "/gc/gogc:percent": "go_gc_gogc_percent",
"/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes", "/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
"/gc/heap/allocs:bytes": "go_gc_heap_allocs_bytes_total", "/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes",
"/gc/heap/allocs:objects": "go_gc_heap_allocs_objects_total", "/gc/heap/allocs:bytes": "go_gc_heap_allocs_bytes_total",
"/gc/heap/frees-by-size:bytes": "go_gc_heap_frees_by_size_bytes", "/gc/heap/allocs:objects": "go_gc_heap_allocs_objects_total",
"/gc/heap/frees:bytes": "go_gc_heap_frees_bytes_total", "/gc/heap/frees-by-size:bytes": "go_gc_heap_frees_by_size_bytes",
"/gc/heap/frees:objects": "go_gc_heap_frees_objects_total", "/gc/heap/frees:bytes": "go_gc_heap_frees_bytes_total",
"/gc/heap/goal:bytes": "go_gc_heap_goal_bytes", "/gc/heap/frees:objects": "go_gc_heap_frees_objects_total",
"/gc/heap/live:bytes": "go_gc_heap_live_bytes", "/gc/heap/goal:bytes": "go_gc_heap_goal_bytes",
"/gc/heap/objects:objects": "go_gc_heap_objects_objects", "/gc/heap/live:bytes": "go_gc_heap_live_bytes",
"/gc/heap/tiny/allocs:objects": "go_gc_heap_tiny_allocs_objects_total", "/gc/heap/objects:objects": "go_gc_heap_objects_objects",
"/gc/limiter/last-enabled:gc-cycle": "go_gc_limiter_last_enabled_gc_cycle", "/gc/heap/tiny/allocs:objects": "go_gc_heap_tiny_allocs_objects_total",
"/gc/pauses:seconds": "go_gc_pauses_seconds", "/gc/limiter/last-enabled:gc-cycle": "go_gc_limiter_last_enabled_gc_cycle",
"/gc/scan/globals:bytes": "go_gc_scan_globals_bytes", "/gc/pauses:seconds": "go_gc_pauses_seconds",
"/gc/scan/heap:bytes": "go_gc_scan_heap_bytes", "/gc/scan/globals:bytes": "go_gc_scan_globals_bytes",
"/gc/scan/stack:bytes": "go_gc_scan_stack_bytes", "/gc/scan/heap:bytes": "go_gc_scan_heap_bytes",
"/gc/scan/total:bytes": "go_gc_scan_total_bytes", "/gc/scan/stack:bytes": "go_gc_scan_stack_bytes",
"/gc/stack/starting-size:bytes": "go_gc_stack_starting_size_bytes", "/gc/scan/total:bytes": "go_gc_scan_total_bytes",
"/godebug/non-default-behavior/execerrdot:events": "go_godebug_non_default_behavior_execerrdot_events_total", "/gc/stack/starting-size:bytes": "go_gc_stack_starting_size_bytes",
"/godebug/non-default-behavior/gocachehash:events": "go_godebug_non_default_behavior_gocachehash_events_total", "/godebug/non-default-behavior/execerrdot:events": "go_godebug_non_default_behavior_execerrdot_events_total",
"/godebug/non-default-behavior/gocachetest:events": "go_godebug_non_default_behavior_gocachetest_events_total", "/godebug/non-default-behavior/gocachehash:events": "go_godebug_non_default_behavior_gocachehash_events_total",
"/godebug/non-default-behavior/gocacheverify:events": "go_godebug_non_default_behavior_gocacheverify_events_total", "/godebug/non-default-behavior/gocachetest:events": "go_godebug_non_default_behavior_gocachetest_events_total",
"/godebug/non-default-behavior/gotypesalias:events": "go_godebug_non_default_behavior_gotypesalias_events_total", "/godebug/non-default-behavior/gocacheverify:events": "go_godebug_non_default_behavior_gocacheverify_events_total",
"/godebug/non-default-behavior/http2client:events": "go_godebug_non_default_behavior_http2client_events_total", "/godebug/non-default-behavior/gotypesalias:events": "go_godebug_non_default_behavior_gotypesalias_events_total",
"/godebug/non-default-behavior/http2server:events": "go_godebug_non_default_behavior_http2server_events_total", "/godebug/non-default-behavior/http2client:events": "go_godebug_non_default_behavior_http2client_events_total",
"/godebug/non-default-behavior/httplaxcontentlength:events": "go_godebug_non_default_behavior_httplaxcontentlength_events_total", "/godebug/non-default-behavior/http2server:events": "go_godebug_non_default_behavior_http2server_events_total",
"/godebug/non-default-behavior/httpmuxgo121:events": "go_godebug_non_default_behavior_httpmuxgo121_events_total", "/godebug/non-default-behavior/httplaxcontentlength:events": "go_godebug_non_default_behavior_httplaxcontentlength_events_total",
"/godebug/non-default-behavior/installgoroot:events": "go_godebug_non_default_behavior_installgoroot_events_total", "/godebug/non-default-behavior/httpmuxgo121:events": "go_godebug_non_default_behavior_httpmuxgo121_events_total",
"/godebug/non-default-behavior/jstmpllitinterp:events": "go_godebug_non_default_behavior_jstmpllitinterp_events_total", "/godebug/non-default-behavior/installgoroot:events": "go_godebug_non_default_behavior_installgoroot_events_total",
"/godebug/non-default-behavior/multipartmaxheaders:events": "go_godebug_non_default_behavior_multipartmaxheaders_events_total", "/godebug/non-default-behavior/jstmpllitinterp:events": "go_godebug_non_default_behavior_jstmpllitinterp_events_total",
"/godebug/non-default-behavior/multipartmaxparts:events": "go_godebug_non_default_behavior_multipartmaxparts_events_total", "/godebug/non-default-behavior/multipartmaxheaders:events": "go_godebug_non_default_behavior_multipartmaxheaders_events_total",
"/godebug/non-default-behavior/multipathtcp:events": "go_godebug_non_default_behavior_multipathtcp_events_total", "/godebug/non-default-behavior/multipartmaxparts:events": "go_godebug_non_default_behavior_multipartmaxparts_events_total",
"/godebug/non-default-behavior/netedns0:events": "go_godebug_non_default_behavior_netedns0_events_total", "/godebug/non-default-behavior/multipathtcp:events": "go_godebug_non_default_behavior_multipathtcp_events_total",
"/godebug/non-default-behavior/panicnil:events": "go_godebug_non_default_behavior_panicnil_events_total", "/godebug/non-default-behavior/netedns0:events": "go_godebug_non_default_behavior_netedns0_events_total",
"/godebug/non-default-behavior/randautoseed:events": "go_godebug_non_default_behavior_randautoseed_events_total", "/godebug/non-default-behavior/panicnil:events": "go_godebug_non_default_behavior_panicnil_events_total",
"/godebug/non-default-behavior/tarinsecurepath:events": "go_godebug_non_default_behavior_tarinsecurepath_events_total", "/godebug/non-default-behavior/randautoseed:events": "go_godebug_non_default_behavior_randautoseed_events_total",
"/godebug/non-default-behavior/tls10server:events": "go_godebug_non_default_behavior_tls10server_events_total", "/godebug/non-default-behavior/tarinsecurepath:events": "go_godebug_non_default_behavior_tarinsecurepath_events_total",
"/godebug/non-default-behavior/tlsmaxrsasize:events": "go_godebug_non_default_behavior_tlsmaxrsasize_events_total", "/godebug/non-default-behavior/tls10server:events": "go_godebug_non_default_behavior_tls10server_events_total",
"/godebug/non-default-behavior/tlsrsakex:events": "go_godebug_non_default_behavior_tlsrsakex_events_total", "/godebug/non-default-behavior/tlsmaxrsasize:events": "go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
"/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total", "/godebug/non-default-behavior/tlsrsakex:events": "go_godebug_non_default_behavior_tlsrsakex_events_total",
"/godebug/non-default-behavior/x509sha1:events": "go_godebug_non_default_behavior_x509sha1_events_total", "/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
"/godebug/non-default-behavior/x509usefallbackroots:events": "go_godebug_non_default_behavior_x509usefallbackroots_events_total", "/godebug/non-default-behavior/x509sha1:events": "go_godebug_non_default_behavior_x509sha1_events_total",
"/godebug/non-default-behavior/x509usepolicies:events": "go_godebug_non_default_behavior_x509usepolicies_events_total", "/godebug/non-default-behavior/x509usefallbackroots:events": "go_godebug_non_default_behavior_x509usefallbackroots_events_total",
"/godebug/non-default-behavior/zipinsecurepath:events": "go_godebug_non_default_behavior_zipinsecurepath_events_total", "/godebug/non-default-behavior/x509usepolicies:events": "go_godebug_non_default_behavior_x509usepolicies_events_total",
"/memory/classes/heap/free:bytes": "go_memory_classes_heap_free_bytes", "/godebug/non-default-behavior/zipinsecurepath:events": "go_godebug_non_default_behavior_zipinsecurepath_events_total",
"/memory/classes/heap/objects:bytes": "go_memory_classes_heap_objects_bytes", "/memory/classes/heap/free:bytes": "go_memory_classes_heap_free_bytes",
"/memory/classes/heap/released:bytes": "go_memory_classes_heap_released_bytes", "/memory/classes/heap/objects:bytes": "go_memory_classes_heap_objects_bytes",
"/memory/classes/heap/stacks:bytes": "go_memory_classes_heap_stacks_bytes", "/memory/classes/heap/released:bytes": "go_memory_classes_heap_released_bytes",
"/memory/classes/heap/unused:bytes": "go_memory_classes_heap_unused_bytes", "/memory/classes/heap/stacks:bytes": "go_memory_classes_heap_stacks_bytes",
"/memory/classes/metadata/mcache/free:bytes": "go_memory_classes_metadata_mcache_free_bytes", "/memory/classes/heap/unused:bytes": "go_memory_classes_heap_unused_bytes",
"/memory/classes/metadata/mcache/inuse:bytes": "go_memory_classes_metadata_mcache_inuse_bytes", "/memory/classes/metadata/mcache/free:bytes": "go_memory_classes_metadata_mcache_free_bytes",
"/memory/classes/metadata/mspan/free:bytes": "go_memory_classes_metadata_mspan_free_bytes", "/memory/classes/metadata/mcache/inuse:bytes": "go_memory_classes_metadata_mcache_inuse_bytes",
"/memory/classes/metadata/mspan/inuse:bytes": "go_memory_classes_metadata_mspan_inuse_bytes", "/memory/classes/metadata/mspan/free:bytes": "go_memory_classes_metadata_mspan_free_bytes",
"/memory/classes/metadata/other:bytes": "go_memory_classes_metadata_other_bytes", "/memory/classes/metadata/mspan/inuse:bytes": "go_memory_classes_metadata_mspan_inuse_bytes",
"/memory/classes/os-stacks:bytes": "go_memory_classes_os_stacks_bytes", "/memory/classes/metadata/other:bytes": "go_memory_classes_metadata_other_bytes",
"/memory/classes/other:bytes": "go_memory_classes_other_bytes", "/memory/classes/os-stacks:bytes": "go_memory_classes_os_stacks_bytes",
"/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes", "/memory/classes/other:bytes": "go_memory_classes_other_bytes",
"/memory/classes/total:bytes": "go_memory_classes_total_bytes", "/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes",
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads", "/memory/classes/total:bytes": "go_memory_classes_total_bytes",
"/sched/goroutines:goroutines": "go_sched_goroutines_goroutines", "/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
"/sched/latencies:seconds": "go_sched_latencies_seconds", "/sched/goroutines:goroutines": "go_sched_goroutines_goroutines",
"/sched/pauses/stopping/gc:seconds": "go_sched_pauses_stopping_gc_seconds", "/sched/latencies:seconds": "go_sched_latencies_seconds",
"/sched/pauses/stopping/other:seconds": "go_sched_pauses_stopping_other_seconds", "/sched/pauses/stopping/gc:seconds": "go_sched_pauses_stopping_gc_seconds",
"/sched/pauses/total/gc:seconds": "go_sched_pauses_total_gc_seconds", "/sched/pauses/stopping/other:seconds": "go_sched_pauses_stopping_other_seconds",
"/sched/pauses/total/other:seconds": "go_sched_pauses_total_other_seconds", "/sched/pauses/total/gc:seconds": "go_sched_pauses_total_gc_seconds",
"/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total", "/sched/pauses/total/other:seconds": "go_sched_pauses_total_other_seconds",
} "/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total",
}
expMetrics = map[string]string{
"/gc/gogc:percent": "go_gc_gogc_percent",
"/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
"/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
}
)
const expectedRuntimeMetricsCardinality = 162 const expectedRuntimeMetricsCardinality = 162

View File

@ -30,3 +30,5 @@ type GoCollectorOptions struct {
RuntimeMetricSumForHist map[string]string RuntimeMetricSumForHist map[string]string
RuntimeMetricRules []GoCollectorRule RuntimeMetricRules []GoCollectorRule
} }
var GoCollectorDefaultRuntimeMetrics = regexp.MustCompile(`/gc/gogc:percent|/gc/gomemlimit:bytes|/sched/gomaxprocs:threads`)