From: Kemal Akkoyun Date: Wed, 11 Feb 2026 18:45:56 +0100 Subject: feat(collector): add Go 1.26 new runtime metrics (#1942) * feat(collector): add Go 1.26 runtime metrics support Add support for 6 new scheduler metrics introduced in Go 1.26: - /sched/goroutines-created:goroutines (counter) - /sched/goroutines/not-in-go:goroutines (gauge) - /sched/goroutines/runnable:goroutines (gauge) - /sched/goroutines/running:goroutines (gauge) - /sched/goroutines/waiting:goroutines (gauge) - /sched/threads/total:threads (gauge) These metrics enable production monitoring for detecting lock contention, syscall blockages, scheduler bottlenecks, and CPU capacity issues. Also includes: - Regenerated Go 1.25 test files for Go 1.25.6 compatibility - Fixed flaky TestTimerObserve test by adding minimum delay - Updated supported_go_versions.json to include Go 1.26rc2 Signed-off-by: Kemal Akkoyun Signed-off-by: Kemal Akkoyun * chore: bump the minimum required version Signed-off-by: Kemal Akkoyun --------- Signed-off-by: Kemal Akkoyun Signed-off-by: Kemal Akkoyun --- prometheus/collectors/go_collector_go124_test.go | 2 ++ prometheus/collectors/go_collector_go125_test.go | 2 ++ ...or_go125_test.go => go_collector_go126_test.go} | 32 ++++++++++++++++++++-- prometheus/go_collector_metrics_go124_test.go | 3 +- prometheus/go_collector_metrics_go125_test.go | 3 +- ..._test.go => go_collector_metrics_go126_test.go} | 22 ++++++++++++--- prometheus/timer_test.go | 5 ++++ 7 files changed, 61 insertions(+), 8 deletions(-) copy prometheus/collectors/{go_collector_go125_test.go => go_collector_go126_test.go} (87%) copy prometheus/{go_collector_metrics_go125_test.go => go_collector_metrics_go126_test.go} (86%) diff --git a/prometheus/collectors/go_collector_go124_test.go b/prometheus/collectors/go_collector_go124_test.go index 358b6a8..6cd704e 100644 --- a/prometheus/collectors/go_collector_go124_test.go +++ b/prometheus/collectors/go_collector_go124_test.go @@ -81,6 +81,7 @@ func withAllMetrics() []string { "go_godebug_non_default_behavior_tlsmaxrsasize_events_total", "go_godebug_non_default_behavior_tlsrsakex_events_total", "go_godebug_non_default_behavior_tlsunsafeekm_events_total", + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "go_godebug_non_default_behavior_winsymlink_events_total", "go_godebug_non_default_behavior_x509keypairleaf_events_total", @@ -203,6 +204,7 @@ func withDebugMetrics() []string { "go_godebug_non_default_behavior_tlsmaxrsasize_events_total", "go_godebug_non_default_behavior_tlsrsakex_events_total", "go_godebug_non_default_behavior_tlsunsafeekm_events_total", + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "go_godebug_non_default_behavior_winsymlink_events_total", "go_godebug_non_default_behavior_x509keypairleaf_events_total", diff --git a/prometheus/collectors/go_collector_go125_test.go b/prometheus/collectors/go_collector_go125_test.go index 874f3ce..9f525c0 100644 --- a/prometheus/collectors/go_collector_go125_test.go +++ b/prometheus/collectors/go_collector_go125_test.go @@ -85,6 +85,7 @@ func withAllMetrics() []string { "go_godebug_non_default_behavior_tlssha1_events_total", "go_godebug_non_default_behavior_tlsunsafeekm_events_total", "go_godebug_non_default_behavior_updatemaxprocs_events_total", + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "go_godebug_non_default_behavior_winsymlink_events_total", "go_godebug_non_default_behavior_x509keypairleaf_events_total", @@ -212,6 +213,7 @@ func withDebugMetrics() []string { "go_godebug_non_default_behavior_tlssha1_events_total", "go_godebug_non_default_behavior_tlsunsafeekm_events_total", "go_godebug_non_default_behavior_updatemaxprocs_events_total", + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "go_godebug_non_default_behavior_winsymlink_events_total", "go_godebug_non_default_behavior_x509keypairleaf_events_total", diff --git a/prometheus/collectors/go_collector_go125_test.go b/prometheus/collectors/go_collector_go126_test.go similarity index 87% copy from prometheus/collectors/go_collector_go125_test.go copy to prometheus/collectors/go_collector_go126_test.go index 874f3ce..5aad924 100644 --- a/prometheus/collectors/go_collector_go125_test.go +++ b/prometheus/collectors/go_collector_go126_test.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.25 && !go1.26 -// +build go1.25,!go1.26 +//go:build go1.26 && !go1.27 +// +build go1.26,!go1.27 package collectors @@ -30,9 +30,13 @@ func withAllMetrics() []string { "go_cpu_classes_scavenge_total_cpu_seconds_total", "go_cpu_classes_total_cpu_seconds_total", "go_cpu_classes_user_cpu_seconds_total", + "go_gc_cleanups_executed_cleanups_total", + "go_gc_cleanups_queued_cleanups_total", "go_gc_cycles_automatic_gc_cycles_total", "go_gc_cycles_forced_gc_cycles_total", "go_gc_cycles_total_gc_cycles_total", + "go_gc_finalizers_executed_finalizers_total", + "go_gc_finalizers_queued_finalizers_total", "go_gc_gogc_percent", "go_gc_gomemlimit_bytes", "go_gc_heap_allocs_by_size_bytes", @@ -55,6 +59,7 @@ func withAllMetrics() []string { "go_godebug_non_default_behavior_allowmultiplevcs_events_total", "go_godebug_non_default_behavior_asynctimerchan_events_total", "go_godebug_non_default_behavior_containermaxprocs_events_total", + "go_godebug_non_default_behavior_cryptocustomrand_events_total", "go_godebug_non_default_behavior_embedfollowsymlinks_events_total", "go_godebug_non_default_behavior_execerrdot_events_total", "go_godebug_non_default_behavior_gocachehash_events_total", @@ -62,6 +67,7 @@ func withAllMetrics() []string { "go_godebug_non_default_behavior_gocacheverify_events_total", "go_godebug_non_default_behavior_gotestjsonbuildtext_events_total", "go_godebug_non_default_behavior_gotypesalias_events_total", + "go_godebug_non_default_behavior_htmlmetacontenturlescape_events_total", "go_godebug_non_default_behavior_http2client_events_total", "go_godebug_non_default_behavior_http2server_events_total", "go_godebug_non_default_behavior_httpcookiemaxnum_events_total", @@ -85,6 +91,8 @@ func withAllMetrics() []string { "go_godebug_non_default_behavior_tlssha1_events_total", "go_godebug_non_default_behavior_tlsunsafeekm_events_total", "go_godebug_non_default_behavior_updatemaxprocs_events_total", + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", + "go_godebug_non_default_behavior_urlstrictcolons_events_total", "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "go_godebug_non_default_behavior_winsymlink_events_total", "go_godebug_non_default_behavior_x509keypairleaf_events_total", @@ -109,21 +117,31 @@ func withAllMetrics() []string { "go_memory_classes_profiling_buckets_bytes", "go_memory_classes_total_bytes", "go_sched_gomaxprocs_threads", + "go_sched_goroutines_created_goroutines_total", "go_sched_goroutines_goroutines", + "go_sched_goroutines_not_in_go_goroutines", + "go_sched_goroutines_runnable_goroutines", + "go_sched_goroutines_running_goroutines", + "go_sched_goroutines_waiting_goroutines", "go_sched_latencies_seconds", "go_sched_pauses_stopping_gc_seconds", "go_sched_pauses_stopping_other_seconds", "go_sched_pauses_total_gc_seconds", "go_sched_pauses_total_other_seconds", + "go_sched_threads_total_threads", "go_sync_mutex_wait_total_seconds_total", }) } func withGCMetrics() []string { return withBaseMetrics([]string{ + "go_gc_cleanups_executed_cleanups_total", + "go_gc_cleanups_queued_cleanups_total", "go_gc_cycles_automatic_gc_cycles_total", "go_gc_cycles_forced_gc_cycles_total", "go_gc_cycles_total_gc_cycles_total", + "go_gc_finalizers_executed_finalizers_total", + "go_gc_finalizers_queued_finalizers_total", "go_gc_gogc_percent", "go_gc_gomemlimit_bytes", "go_gc_heap_allocs_by_size_bytes", @@ -168,12 +186,18 @@ func withMemoryMetrics() []string { func withSchedulerMetrics() []string { return withBaseMetrics([]string{ "go_sched_gomaxprocs_threads", + "go_sched_goroutines_created_goroutines_total", "go_sched_goroutines_goroutines", + "go_sched_goroutines_not_in_go_goroutines", + "go_sched_goroutines_runnable_goroutines", + "go_sched_goroutines_running_goroutines", + "go_sched_goroutines_waiting_goroutines", "go_sched_latencies_seconds", "go_sched_pauses_stopping_gc_seconds", "go_sched_pauses_stopping_other_seconds", "go_sched_pauses_total_gc_seconds", "go_sched_pauses_total_other_seconds", + "go_sched_threads_total_threads", }) } @@ -182,6 +206,7 @@ func withDebugMetrics() []string { "go_godebug_non_default_behavior_allowmultiplevcs_events_total", "go_godebug_non_default_behavior_asynctimerchan_events_total", "go_godebug_non_default_behavior_containermaxprocs_events_total", + "go_godebug_non_default_behavior_cryptocustomrand_events_total", "go_godebug_non_default_behavior_embedfollowsymlinks_events_total", "go_godebug_non_default_behavior_execerrdot_events_total", "go_godebug_non_default_behavior_gocachehash_events_total", @@ -189,6 +214,7 @@ func withDebugMetrics() []string { "go_godebug_non_default_behavior_gocacheverify_events_total", "go_godebug_non_default_behavior_gotestjsonbuildtext_events_total", "go_godebug_non_default_behavior_gotypesalias_events_total", + "go_godebug_non_default_behavior_htmlmetacontenturlescape_events_total", "go_godebug_non_default_behavior_http2client_events_total", "go_godebug_non_default_behavior_http2server_events_total", "go_godebug_non_default_behavior_httpcookiemaxnum_events_total", @@ -212,6 +238,8 @@ func withDebugMetrics() []string { "go_godebug_non_default_behavior_tlssha1_events_total", "go_godebug_non_default_behavior_tlsunsafeekm_events_total", "go_godebug_non_default_behavior_updatemaxprocs_events_total", + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", + "go_godebug_non_default_behavior_urlstrictcolons_events_total", "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "go_godebug_non_default_behavior_winsymlink_events_total", "go_godebug_non_default_behavior_x509keypairleaf_events_total", diff --git a/prometheus/go_collector_metrics_go124_test.go b/prometheus/go_collector_metrics_go124_test.go index 75c55aa..d900fbc 100644 --- a/prometheus/go_collector_metrics_go124_test.go +++ b/prometheus/go_collector_metrics_go124_test.go @@ -71,6 +71,7 @@ var ( "/godebug/non-default-behavior/tlsmaxrsasize:events": "go_godebug_non_default_behavior_tlsmaxrsasize_events_total", "/godebug/non-default-behavior/tlsrsakex:events": "go_godebug_non_default_behavior_tlsrsakex_events_total", "/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total", + "/godebug/non-default-behavior/urlmaxqueryparams:events": "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", "/godebug/non-default-behavior/winreadlinkvolume:events": "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "/godebug/non-default-behavior/winsymlink:events": "go_godebug_non_default_behavior_winsymlink_events_total", "/godebug/non-default-behavior/x509keypairleaf:events": "go_godebug_non_default_behavior_x509keypairleaf_events_total", @@ -110,4 +111,4 @@ var ( } ) -const expectedRuntimeMetricsCardinality = 173 +const expectedRuntimeMetricsCardinality = 174 diff --git a/prometheus/go_collector_metrics_go125_test.go b/prometheus/go_collector_metrics_go125_test.go index e0276a2..5662580 100644 --- a/prometheus/go_collector_metrics_go125_test.go +++ b/prometheus/go_collector_metrics_go125_test.go @@ -75,6 +75,7 @@ var ( "/godebug/non-default-behavior/tlssha1:events": "go_godebug_non_default_behavior_tlssha1_events_total", "/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total", "/godebug/non-default-behavior/updatemaxprocs:events": "go_godebug_non_default_behavior_updatemaxprocs_events_total", + "/godebug/non-default-behavior/urlmaxqueryparams:events": "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", "/godebug/non-default-behavior/winreadlinkvolume:events": "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "/godebug/non-default-behavior/winsymlink:events": "go_godebug_non_default_behavior_winsymlink_events_total", "/godebug/non-default-behavior/x509keypairleaf:events": "go_godebug_non_default_behavior_x509keypairleaf_events_total", @@ -115,4 +116,4 @@ var ( } ) -const expectedRuntimeMetricsCardinality = 178 +const expectedRuntimeMetricsCardinality = 179 diff --git a/prometheus/go_collector_metrics_go125_test.go b/prometheus/go_collector_metrics_go126_test.go similarity index 86% copy from prometheus/go_collector_metrics_go125_test.go copy to prometheus/go_collector_metrics_go126_test.go index e0276a2..c1b582c 100644 --- a/prometheus/go_collector_metrics_go125_test.go +++ b/prometheus/go_collector_metrics_go126_test.go @@ -1,8 +1,8 @@ // Code generated by gen_go_collector_metrics_set.go; DO NOT EDIT. -//go:generate go run gen_go_collector_metrics_set.go go1.25 +//go:generate go run gen_go_collector_metrics_set.go go1.26 -//go:build go1.25 && !go1.26 -// +build go1.25,!go1.26 +//go:build go1.26 && !go1.27 +// +build go1.26,!go1.27 package prometheus @@ -20,9 +20,13 @@ var ( "/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total", "/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total", "/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total", + "/gc/cleanups/executed:cleanups": "go_gc_cleanups_executed_cleanups_total", + "/gc/cleanups/queued:cleanups": "go_gc_cleanups_queued_cleanups_total", "/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total", "/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total", "/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total", + "/gc/finalizers/executed:finalizers": "go_gc_finalizers_executed_finalizers_total", + "/gc/finalizers/queued:finalizers": "go_gc_finalizers_queued_finalizers_total", "/gc/gogc:percent": "go_gc_gogc_percent", "/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes", "/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes", @@ -45,6 +49,7 @@ var ( "/godebug/non-default-behavior/allowmultiplevcs:events": "go_godebug_non_default_behavior_allowmultiplevcs_events_total", "/godebug/non-default-behavior/asynctimerchan:events": "go_godebug_non_default_behavior_asynctimerchan_events_total", "/godebug/non-default-behavior/containermaxprocs:events": "go_godebug_non_default_behavior_containermaxprocs_events_total", + "/godebug/non-default-behavior/cryptocustomrand:events": "go_godebug_non_default_behavior_cryptocustomrand_events_total", "/godebug/non-default-behavior/embedfollowsymlinks:events": "go_godebug_non_default_behavior_embedfollowsymlinks_events_total", "/godebug/non-default-behavior/execerrdot:events": "go_godebug_non_default_behavior_execerrdot_events_total", "/godebug/non-default-behavior/gocachehash:events": "go_godebug_non_default_behavior_gocachehash_events_total", @@ -52,6 +57,7 @@ var ( "/godebug/non-default-behavior/gocacheverify:events": "go_godebug_non_default_behavior_gocacheverify_events_total", "/godebug/non-default-behavior/gotestjsonbuildtext:events": "go_godebug_non_default_behavior_gotestjsonbuildtext_events_total", "/godebug/non-default-behavior/gotypesalias:events": "go_godebug_non_default_behavior_gotypesalias_events_total", + "/godebug/non-default-behavior/htmlmetacontenturlescape:events": "go_godebug_non_default_behavior_htmlmetacontenturlescape_events_total", "/godebug/non-default-behavior/http2client:events": "go_godebug_non_default_behavior_http2client_events_total", "/godebug/non-default-behavior/http2server:events": "go_godebug_non_default_behavior_http2server_events_total", "/godebug/non-default-behavior/httpcookiemaxnum:events": "go_godebug_non_default_behavior_httpcookiemaxnum_events_total", @@ -75,6 +81,8 @@ var ( "/godebug/non-default-behavior/tlssha1:events": "go_godebug_non_default_behavior_tlssha1_events_total", "/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total", "/godebug/non-default-behavior/updatemaxprocs:events": "go_godebug_non_default_behavior_updatemaxprocs_events_total", + "/godebug/non-default-behavior/urlmaxqueryparams:events": "go_godebug_non_default_behavior_urlmaxqueryparams_events_total", + "/godebug/non-default-behavior/urlstrictcolons:events": "go_godebug_non_default_behavior_urlstrictcolons_events_total", "/godebug/non-default-behavior/winreadlinkvolume:events": "go_godebug_non_default_behavior_winreadlinkvolume_events_total", "/godebug/non-default-behavior/winsymlink:events": "go_godebug_non_default_behavior_winsymlink_events_total", "/godebug/non-default-behavior/x509keypairleaf:events": "go_godebug_non_default_behavior_x509keypairleaf_events_total", @@ -99,12 +107,18 @@ var ( "/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes", "/memory/classes/total:bytes": "go_memory_classes_total_bytes", "/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads", + "/sched/goroutines-created:goroutines": "go_sched_goroutines_created_goroutines_total", + "/sched/goroutines/not-in-go:goroutines": "go_sched_goroutines_not_in_go_goroutines", + "/sched/goroutines/runnable:goroutines": "go_sched_goroutines_runnable_goroutines", + "/sched/goroutines/running:goroutines": "go_sched_goroutines_running_goroutines", + "/sched/goroutines/waiting:goroutines": "go_sched_goroutines_waiting_goroutines", "/sched/goroutines:goroutines": "go_sched_goroutines_goroutines", "/sched/latencies:seconds": "go_sched_latencies_seconds", "/sched/pauses/stopping/gc:seconds": "go_sched_pauses_stopping_gc_seconds", "/sched/pauses/stopping/other:seconds": "go_sched_pauses_stopping_other_seconds", "/sched/pauses/total/gc:seconds": "go_sched_pauses_total_gc_seconds", "/sched/pauses/total/other:seconds": "go_sched_pauses_total_other_seconds", + "/sched/threads/total:threads": "go_sched_threads_total_threads", "/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total", } @@ -115,4 +129,4 @@ var ( } ) -const expectedRuntimeMetricsCardinality = 178 +const expectedRuntimeMetricsCardinality = 192 diff --git a/prometheus/timer_test.go b/prometheus/timer_test.go index a27912d..ce284e8 100644 --- a/prometheus/timer_test.go +++ b/prometheus/timer_test.go @@ -16,6 +16,7 @@ package prometheus import ( "reflect" "testing" + "time" "google.golang.org/protobuf/proto" @@ -36,6 +37,8 @@ func TestTimerObserve(t *testing.T) { defer hisTimer.ObserveDuration() defer sumTimer.ObserveDuration() defer gaugeTimer.ObserveDuration() + // Ensure measurable time passes to avoid flaky test on fast systems. + time.Sleep(time.Millisecond) }() m := &dto.Metric{} @@ -71,6 +74,8 @@ func TestTimerObserveWithExemplar(t *testing.T) { // Gauges and summaries does not implement ExemplarObserver, so we expect them to ignore exemplar. defer sumTimer.ObserveDurationWithExemplar(exemplar) defer gaugeTimer.ObserveDurationWithExemplar(exemplar) + // Ensure measurable time passes to avoid flaky test on fast systems. + time.Sleep(time.Millisecond) }() m := &dto.Metric{}