Skip to content

Commit d0f052c

Browse files
committed
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 <kakkoyun@gmail.com> Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
1 parent fb0838f commit d0f052c

7 files changed

Lines changed: 411 additions & 2 deletions

File tree

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
run: make check-crlf
5454

5555
- name: Set up Go ${{ matrix.version }}
56-
uses: actions/setup-go@v6.0.0
56+
uses: actions/setup-go@v6
5757
with:
5858
go-version: ${{ matrix.version }}
5959
check-latest: true

prometheus/collectors/go_collector_go125_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func withAllMetrics() []string {
8585
"go_godebug_non_default_behavior_tlssha1_events_total",
8686
"go_godebug_non_default_behavior_tlsunsafeekm_events_total",
8787
"go_godebug_non_default_behavior_updatemaxprocs_events_total",
88+
"go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
8889
"go_godebug_non_default_behavior_winreadlinkvolume_events_total",
8990
"go_godebug_non_default_behavior_winsymlink_events_total",
9091
"go_godebug_non_default_behavior_x509keypairleaf_events_total",
@@ -212,6 +213,7 @@ func withDebugMetrics() []string {
212213
"go_godebug_non_default_behavior_tlssha1_events_total",
213214
"go_godebug_non_default_behavior_tlsunsafeekm_events_total",
214215
"go_godebug_non_default_behavior_updatemaxprocs_events_total",
216+
"go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
215217
"go_godebug_non_default_behavior_winreadlinkvolume_events_total",
216218
"go_godebug_non_default_behavior_winsymlink_events_total",
217219
"go_godebug_non_default_behavior_x509keypairleaf_events_total",
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
// Copyright 2022 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.26 && !go1.27
15+
// +build go1.26,!go1.27
16+
17+
package collectors
18+
19+
func withAllMetrics() []string {
20+
return withBaseMetrics([]string{
21+
"go_cgo_go_to_c_calls_calls_total",
22+
"go_cpu_classes_gc_mark_assist_cpu_seconds_total",
23+
"go_cpu_classes_gc_mark_dedicated_cpu_seconds_total",
24+
"go_cpu_classes_gc_mark_idle_cpu_seconds_total",
25+
"go_cpu_classes_gc_pause_cpu_seconds_total",
26+
"go_cpu_classes_gc_total_cpu_seconds_total",
27+
"go_cpu_classes_idle_cpu_seconds_total",
28+
"go_cpu_classes_scavenge_assist_cpu_seconds_total",
29+
"go_cpu_classes_scavenge_background_cpu_seconds_total",
30+
"go_cpu_classes_scavenge_total_cpu_seconds_total",
31+
"go_cpu_classes_total_cpu_seconds_total",
32+
"go_cpu_classes_user_cpu_seconds_total",
33+
"go_gc_cleanups_executed_cleanups_total",
34+
"go_gc_cleanups_queued_cleanups_total",
35+
"go_gc_cycles_automatic_gc_cycles_total",
36+
"go_gc_cycles_forced_gc_cycles_total",
37+
"go_gc_cycles_total_gc_cycles_total",
38+
"go_gc_finalizers_executed_finalizers_total",
39+
"go_gc_finalizers_queued_finalizers_total",
40+
"go_gc_gogc_percent",
41+
"go_gc_gomemlimit_bytes",
42+
"go_gc_heap_allocs_by_size_bytes",
43+
"go_gc_heap_allocs_bytes_total",
44+
"go_gc_heap_allocs_objects_total",
45+
"go_gc_heap_frees_by_size_bytes",
46+
"go_gc_heap_frees_bytes_total",
47+
"go_gc_heap_frees_objects_total",
48+
"go_gc_heap_goal_bytes",
49+
"go_gc_heap_live_bytes",
50+
"go_gc_heap_objects_objects",
51+
"go_gc_heap_tiny_allocs_objects_total",
52+
"go_gc_limiter_last_enabled_gc_cycle",
53+
"go_gc_pauses_seconds",
54+
"go_gc_scan_globals_bytes",
55+
"go_gc_scan_heap_bytes",
56+
"go_gc_scan_stack_bytes",
57+
"go_gc_scan_total_bytes",
58+
"go_gc_stack_starting_size_bytes",
59+
"go_godebug_non_default_behavior_allowmultiplevcs_events_total",
60+
"go_godebug_non_default_behavior_asynctimerchan_events_total",
61+
"go_godebug_non_default_behavior_containermaxprocs_events_total",
62+
"go_godebug_non_default_behavior_cryptocustomrand_events_total",
63+
"go_godebug_non_default_behavior_embedfollowsymlinks_events_total",
64+
"go_godebug_non_default_behavior_execerrdot_events_total",
65+
"go_godebug_non_default_behavior_gocachehash_events_total",
66+
"go_godebug_non_default_behavior_gocachetest_events_total",
67+
"go_godebug_non_default_behavior_gocacheverify_events_total",
68+
"go_godebug_non_default_behavior_gotestjsonbuildtext_events_total",
69+
"go_godebug_non_default_behavior_gotypesalias_events_total",
70+
"go_godebug_non_default_behavior_http2client_events_total",
71+
"go_godebug_non_default_behavior_http2server_events_total",
72+
"go_godebug_non_default_behavior_httpcookiemaxnum_events_total",
73+
"go_godebug_non_default_behavior_httplaxcontentlength_events_total",
74+
"go_godebug_non_default_behavior_httpmuxgo121_events_total",
75+
"go_godebug_non_default_behavior_httpservecontentkeepheaders_events_total",
76+
"go_godebug_non_default_behavior_installgoroot_events_total",
77+
"go_godebug_non_default_behavior_multipartmaxheaders_events_total",
78+
"go_godebug_non_default_behavior_multipartmaxparts_events_total",
79+
"go_godebug_non_default_behavior_multipathtcp_events_total",
80+
"go_godebug_non_default_behavior_netedns0_events_total",
81+
"go_godebug_non_default_behavior_panicnil_events_total",
82+
"go_godebug_non_default_behavior_randautoseed_events_total",
83+
"go_godebug_non_default_behavior_randseednop_events_total",
84+
"go_godebug_non_default_behavior_rsa1024min_events_total",
85+
"go_godebug_non_default_behavior_tarinsecurepath_events_total",
86+
"go_godebug_non_default_behavior_tls10server_events_total",
87+
"go_godebug_non_default_behavior_tls3des_events_total",
88+
"go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
89+
"go_godebug_non_default_behavior_tlsrsakex_events_total",
90+
"go_godebug_non_default_behavior_tlssha1_events_total",
91+
"go_godebug_non_default_behavior_tlsunsafeekm_events_total",
92+
"go_godebug_non_default_behavior_updatemaxprocs_events_total",
93+
"go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
94+
"go_godebug_non_default_behavior_urlstrictcolons_events_total",
95+
"go_godebug_non_default_behavior_winreadlinkvolume_events_total",
96+
"go_godebug_non_default_behavior_winsymlink_events_total",
97+
"go_godebug_non_default_behavior_x509keypairleaf_events_total",
98+
"go_godebug_non_default_behavior_x509negativeserial_events_total",
99+
"go_godebug_non_default_behavior_x509rsacrt_events_total",
100+
"go_godebug_non_default_behavior_x509sha256skid_events_total",
101+
"go_godebug_non_default_behavior_x509usefallbackroots_events_total",
102+
"go_godebug_non_default_behavior_x509usepolicies_events_total",
103+
"go_godebug_non_default_behavior_zipinsecurepath_events_total",
104+
"go_memory_classes_heap_free_bytes",
105+
"go_memory_classes_heap_objects_bytes",
106+
"go_memory_classes_heap_released_bytes",
107+
"go_memory_classes_heap_stacks_bytes",
108+
"go_memory_classes_heap_unused_bytes",
109+
"go_memory_classes_metadata_mcache_free_bytes",
110+
"go_memory_classes_metadata_mcache_inuse_bytes",
111+
"go_memory_classes_metadata_mspan_free_bytes",
112+
"go_memory_classes_metadata_mspan_inuse_bytes",
113+
"go_memory_classes_metadata_other_bytes",
114+
"go_memory_classes_os_stacks_bytes",
115+
"go_memory_classes_other_bytes",
116+
"go_memory_classes_profiling_buckets_bytes",
117+
"go_memory_classes_total_bytes",
118+
"go_sched_gomaxprocs_threads",
119+
"go_sched_goroutines_created_goroutines_total",
120+
"go_sched_goroutines_goroutines",
121+
"go_sched_goroutines_not_in_go_goroutines",
122+
"go_sched_goroutines_runnable_goroutines",
123+
"go_sched_goroutines_running_goroutines",
124+
"go_sched_goroutines_waiting_goroutines",
125+
"go_sched_latencies_seconds",
126+
"go_sched_pauses_stopping_gc_seconds",
127+
"go_sched_pauses_stopping_other_seconds",
128+
"go_sched_pauses_total_gc_seconds",
129+
"go_sched_pauses_total_other_seconds",
130+
"go_sched_threads_total_threads",
131+
"go_sync_mutex_wait_total_seconds_total",
132+
})
133+
}
134+
135+
func withGCMetrics() []string {
136+
return withBaseMetrics([]string{
137+
"go_gc_cleanups_executed_cleanups_total",
138+
"go_gc_cleanups_queued_cleanups_total",
139+
"go_gc_cycles_automatic_gc_cycles_total",
140+
"go_gc_cycles_forced_gc_cycles_total",
141+
"go_gc_cycles_total_gc_cycles_total",
142+
"go_gc_finalizers_executed_finalizers_total",
143+
"go_gc_finalizers_queued_finalizers_total",
144+
"go_gc_gogc_percent",
145+
"go_gc_gomemlimit_bytes",
146+
"go_gc_heap_allocs_by_size_bytes",
147+
"go_gc_heap_allocs_bytes_total",
148+
"go_gc_heap_allocs_objects_total",
149+
"go_gc_heap_frees_by_size_bytes",
150+
"go_gc_heap_frees_bytes_total",
151+
"go_gc_heap_frees_objects_total",
152+
"go_gc_heap_goal_bytes",
153+
"go_gc_heap_live_bytes",
154+
"go_gc_heap_objects_objects",
155+
"go_gc_heap_tiny_allocs_objects_total",
156+
"go_gc_limiter_last_enabled_gc_cycle",
157+
"go_gc_pauses_seconds",
158+
"go_gc_scan_globals_bytes",
159+
"go_gc_scan_heap_bytes",
160+
"go_gc_scan_stack_bytes",
161+
"go_gc_scan_total_bytes",
162+
"go_gc_stack_starting_size_bytes",
163+
})
164+
}
165+
166+
func withMemoryMetrics() []string {
167+
return withBaseMetrics([]string{
168+
"go_memory_classes_heap_free_bytes",
169+
"go_memory_classes_heap_objects_bytes",
170+
"go_memory_classes_heap_released_bytes",
171+
"go_memory_classes_heap_stacks_bytes",
172+
"go_memory_classes_heap_unused_bytes",
173+
"go_memory_classes_metadata_mcache_free_bytes",
174+
"go_memory_classes_metadata_mcache_inuse_bytes",
175+
"go_memory_classes_metadata_mspan_free_bytes",
176+
"go_memory_classes_metadata_mspan_inuse_bytes",
177+
"go_memory_classes_metadata_other_bytes",
178+
"go_memory_classes_os_stacks_bytes",
179+
"go_memory_classes_other_bytes",
180+
"go_memory_classes_profiling_buckets_bytes",
181+
"go_memory_classes_total_bytes",
182+
})
183+
}
184+
185+
func withSchedulerMetrics() []string {
186+
return withBaseMetrics([]string{
187+
"go_sched_gomaxprocs_threads",
188+
"go_sched_goroutines_created_goroutines_total",
189+
"go_sched_goroutines_goroutines",
190+
"go_sched_goroutines_not_in_go_goroutines",
191+
"go_sched_goroutines_runnable_goroutines",
192+
"go_sched_goroutines_running_goroutines",
193+
"go_sched_goroutines_waiting_goroutines",
194+
"go_sched_latencies_seconds",
195+
"go_sched_pauses_stopping_gc_seconds",
196+
"go_sched_pauses_stopping_other_seconds",
197+
"go_sched_pauses_total_gc_seconds",
198+
"go_sched_pauses_total_other_seconds",
199+
"go_sched_threads_total_threads",
200+
})
201+
}
202+
203+
func withDebugMetrics() []string {
204+
return withBaseMetrics([]string{
205+
"go_godebug_non_default_behavior_allowmultiplevcs_events_total",
206+
"go_godebug_non_default_behavior_asynctimerchan_events_total",
207+
"go_godebug_non_default_behavior_containermaxprocs_events_total",
208+
"go_godebug_non_default_behavior_cryptocustomrand_events_total",
209+
"go_godebug_non_default_behavior_embedfollowsymlinks_events_total",
210+
"go_godebug_non_default_behavior_execerrdot_events_total",
211+
"go_godebug_non_default_behavior_gocachehash_events_total",
212+
"go_godebug_non_default_behavior_gocachetest_events_total",
213+
"go_godebug_non_default_behavior_gocacheverify_events_total",
214+
"go_godebug_non_default_behavior_gotestjsonbuildtext_events_total",
215+
"go_godebug_non_default_behavior_gotypesalias_events_total",
216+
"go_godebug_non_default_behavior_http2client_events_total",
217+
"go_godebug_non_default_behavior_http2server_events_total",
218+
"go_godebug_non_default_behavior_httpcookiemaxnum_events_total",
219+
"go_godebug_non_default_behavior_httplaxcontentlength_events_total",
220+
"go_godebug_non_default_behavior_httpmuxgo121_events_total",
221+
"go_godebug_non_default_behavior_httpservecontentkeepheaders_events_total",
222+
"go_godebug_non_default_behavior_installgoroot_events_total",
223+
"go_godebug_non_default_behavior_multipartmaxheaders_events_total",
224+
"go_godebug_non_default_behavior_multipartmaxparts_events_total",
225+
"go_godebug_non_default_behavior_multipathtcp_events_total",
226+
"go_godebug_non_default_behavior_netedns0_events_total",
227+
"go_godebug_non_default_behavior_panicnil_events_total",
228+
"go_godebug_non_default_behavior_randautoseed_events_total",
229+
"go_godebug_non_default_behavior_randseednop_events_total",
230+
"go_godebug_non_default_behavior_rsa1024min_events_total",
231+
"go_godebug_non_default_behavior_tarinsecurepath_events_total",
232+
"go_godebug_non_default_behavior_tls10server_events_total",
233+
"go_godebug_non_default_behavior_tls3des_events_total",
234+
"go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
235+
"go_godebug_non_default_behavior_tlsrsakex_events_total",
236+
"go_godebug_non_default_behavior_tlssha1_events_total",
237+
"go_godebug_non_default_behavior_tlsunsafeekm_events_total",
238+
"go_godebug_non_default_behavior_updatemaxprocs_events_total",
239+
"go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
240+
"go_godebug_non_default_behavior_urlstrictcolons_events_total",
241+
"go_godebug_non_default_behavior_winreadlinkvolume_events_total",
242+
"go_godebug_non_default_behavior_winsymlink_events_total",
243+
"go_godebug_non_default_behavior_x509keypairleaf_events_total",
244+
"go_godebug_non_default_behavior_x509negativeserial_events_total",
245+
"go_godebug_non_default_behavior_x509rsacrt_events_total",
246+
"go_godebug_non_default_behavior_x509sha256skid_events_total",
247+
"go_godebug_non_default_behavior_x509usefallbackroots_events_total",
248+
"go_godebug_non_default_behavior_x509usepolicies_events_total",
249+
"go_godebug_non_default_behavior_zipinsecurepath_events_total",
250+
})
251+
}
252+
253+
var (
254+
defaultRuntimeMetrics = []string{
255+
"go_gc_gogc_percent",
256+
"go_gc_gomemlimit_bytes",
257+
"go_sched_gomaxprocs_threads",
258+
}
259+
onlyGCDefRuntimeMetrics = []string{
260+
"go_gc_gogc_percent",
261+
"go_gc_gomemlimit_bytes",
262+
}
263+
onlySchedDefRuntimeMetrics = []string{
264+
"go_sched_gomaxprocs_threads",
265+
}
266+
)

prometheus/go_collector_metrics_go125_test.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)