Debian Codegraph @

debian/patches/0006-feat-collector-add-Go-1.26-new-runtime-metrics-1942.patch

raw
1 From: Kemal Akkoyun <[email protected]>
2 Date: Wed, 11 Feb 2026 18:45:56 +0100
3 Subject: feat(collector): add Go 1.26 new runtime metrics (#1942)
4
5 * feat(collector): add Go 1.26 runtime metrics support
6
7 Add support for 6 new scheduler metrics introduced in Go 1.26:
8 - /sched/goroutines-created:goroutines (counter)
9 - /sched/goroutines/not-in-go:goroutines (gauge)
10 - /sched/goroutines/runnable:goroutines (gauge)
11 - /sched/goroutines/running:goroutines (gauge)
12 - /sched/goroutines/waiting:goroutines (gauge)
13 - /sched/threads/total:threads (gauge)
14
15 These metrics enable production monitoring for detecting lock contention,
16 syscall blockages, scheduler bottlenecks, and CPU capacity issues.
17
18 Also includes:
19 - Regenerated Go 1.25 test files for Go 1.25.6 compatibility
20 - Fixed flaky TestTimerObserve test by adding minimum delay
21 - Updated supported_go_versions.json to include Go 1.26rc2
22
23 Signed-off-by: Kemal Akkoyun <[email protected]>
24 Signed-off-by: Kemal Akkoyun <[email protected]>
25
26 * chore: bump the minimum required version
27
28 Signed-off-by: Kemal Akkoyun <[email protected]>
29
30 ---------
31
32 Signed-off-by: Kemal Akkoyun <[email protected]>
33 Signed-off-by: Kemal Akkoyun <[email protected]>
34 ---
35 prometheus/collectors/go_collector_go124_test.go | 2 ++
36 prometheus/collectors/go_collector_go125_test.go | 2 ++
37 ...or_go125_test.go => go_collector_go126_test.go} | 32 ++++++++++++++++++++--
38 prometheus/go_collector_metrics_go124_test.go | 3 +-
39 prometheus/go_collector_metrics_go125_test.go | 3 +-
40 ..._test.go => go_collector_metrics_go126_test.go} | 22 ++++++++++++---
41 prometheus/timer_test.go | 5 ++++
42 7 files changed, 61 insertions(+), 8 deletions(-)
43 copy prometheus/collectors/{go_collector_go125_test.go => go_collector_go126_test.go} (87%)
44 copy prometheus/{go_collector_metrics_go125_test.go => go_collector_metrics_go126_test.go} (86%)
45
46 diff --git a/prometheus/collectors/go_collector_go124_test.go b/prometheus/collectors/go_collector_go124_test.go
47 index 358b6a8..6cd704e 100644
48 --- a/prometheus/collectors/go_collector_go124_test.go
49 +++ b/prometheus/collectors/go_collector_go124_test.go
50 @@ -81,6 +81,7 @@ func withAllMetrics() []string {
51 "go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
52 "go_godebug_non_default_behavior_tlsrsakex_events_total",
53 "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
54 + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
55 "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
56 "go_godebug_non_default_behavior_winsymlink_events_total",
57 "go_godebug_non_default_behavior_x509keypairleaf_events_total",
58 @@ -203,6 +204,7 @@ func withDebugMetrics() []string {
59 "go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
60 "go_godebug_non_default_behavior_tlsrsakex_events_total",
61 "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
62 + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
63 "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
64 "go_godebug_non_default_behavior_winsymlink_events_total",
65 "go_godebug_non_default_behavior_x509keypairleaf_events_total",
66 diff --git a/prometheus/collectors/go_collector_go125_test.go b/prometheus/collectors/go_collector_go125_test.go
67 index 874f3ce..9f525c0 100644
68 --- a/prometheus/collectors/go_collector_go125_test.go
69 +++ b/prometheus/collectors/go_collector_go125_test.go
70 @@ -85,6 +85,7 @@ func withAllMetrics() []string {
71 "go_godebug_non_default_behavior_tlssha1_events_total",
72 "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
73 "go_godebug_non_default_behavior_updatemaxprocs_events_total",
74 + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
75 "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
76 "go_godebug_non_default_behavior_winsymlink_events_total",
77 "go_godebug_non_default_behavior_x509keypairleaf_events_total",
78 @@ -212,6 +213,7 @@ func withDebugMetrics() []string {
79 "go_godebug_non_default_behavior_tlssha1_events_total",
80 "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
81 "go_godebug_non_default_behavior_updatemaxprocs_events_total",
82 + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
83 "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
84 "go_godebug_non_default_behavior_winsymlink_events_total",
85 "go_godebug_non_default_behavior_x509keypairleaf_events_total",
86 diff --git a/prometheus/collectors/go_collector_go125_test.go b/prometheus/collectors/go_collector_go126_test.go
87 similarity index 87%
88 copy from prometheus/collectors/go_collector_go125_test.go
89 copy to prometheus/collectors/go_collector_go126_test.go
90 index 874f3ce..5aad924 100644
91 --- a/prometheus/collectors/go_collector_go125_test.go
92 +++ b/prometheus/collectors/go_collector_go126_test.go
93 @@ -11,8 +11,8 @@
94 // See the License for the specific language governing permissions and
95 // limitations under the License.
96
97 -//go:build go1.25 && !go1.26
98 -// +build go1.25,!go1.26
99 +//go:build go1.26 && !go1.27
100 +// +build go1.26,!go1.27
101
102 package collectors
103
104 @@ -30,9 +30,13 @@ func withAllMetrics() []string {
105 "go_cpu_classes_scavenge_total_cpu_seconds_total",
106 "go_cpu_classes_total_cpu_seconds_total",
107 "go_cpu_classes_user_cpu_seconds_total",
108 + "go_gc_cleanups_executed_cleanups_total",
109 + "go_gc_cleanups_queued_cleanups_total",
110 "go_gc_cycles_automatic_gc_cycles_total",
111 "go_gc_cycles_forced_gc_cycles_total",
112 "go_gc_cycles_total_gc_cycles_total",
113 + "go_gc_finalizers_executed_finalizers_total",
114 + "go_gc_finalizers_queued_finalizers_total",
115 "go_gc_gogc_percent",
116 "go_gc_gomemlimit_bytes",
117 "go_gc_heap_allocs_by_size_bytes",
118 @@ -55,6 +59,7 @@ func withAllMetrics() []string {
119 "go_godebug_non_default_behavior_allowmultiplevcs_events_total",
120 "go_godebug_non_default_behavior_asynctimerchan_events_total",
121 "go_godebug_non_default_behavior_containermaxprocs_events_total",
122 + "go_godebug_non_default_behavior_cryptocustomrand_events_total",
123 "go_godebug_non_default_behavior_embedfollowsymlinks_events_total",
124 "go_godebug_non_default_behavior_execerrdot_events_total",
125 "go_godebug_non_default_behavior_gocachehash_events_total",
126 @@ -62,6 +67,7 @@ func withAllMetrics() []string {
127 "go_godebug_non_default_behavior_gocacheverify_events_total",
128 "go_godebug_non_default_behavior_gotestjsonbuildtext_events_total",
129 "go_godebug_non_default_behavior_gotypesalias_events_total",
130 + "go_godebug_non_default_behavior_htmlmetacontenturlescape_events_total",
131 "go_godebug_non_default_behavior_http2client_events_total",
132 "go_godebug_non_default_behavior_http2server_events_total",
133 "go_godebug_non_default_behavior_httpcookiemaxnum_events_total",
134 @@ -85,6 +91,8 @@ func withAllMetrics() []string {
135 "go_godebug_non_default_behavior_tlssha1_events_total",
136 "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
137 "go_godebug_non_default_behavior_updatemaxprocs_events_total",
138 + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
139 + "go_godebug_non_default_behavior_urlstrictcolons_events_total",
140 "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
141 "go_godebug_non_default_behavior_winsymlink_events_total",
142 "go_godebug_non_default_behavior_x509keypairleaf_events_total",
143 @@ -109,21 +117,31 @@ func withAllMetrics() []string {
144 "go_memory_classes_profiling_buckets_bytes",
145 "go_memory_classes_total_bytes",
146 "go_sched_gomaxprocs_threads",
147 + "go_sched_goroutines_created_goroutines_total",
148 "go_sched_goroutines_goroutines",
149 + "go_sched_goroutines_not_in_go_goroutines",
150 + "go_sched_goroutines_runnable_goroutines",
151 + "go_sched_goroutines_running_goroutines",
152 + "go_sched_goroutines_waiting_goroutines",
153 "go_sched_latencies_seconds",
154 "go_sched_pauses_stopping_gc_seconds",
155 "go_sched_pauses_stopping_other_seconds",
156 "go_sched_pauses_total_gc_seconds",
157 "go_sched_pauses_total_other_seconds",
158 + "go_sched_threads_total_threads",
159 "go_sync_mutex_wait_total_seconds_total",
160 })
161 }
162
163 func withGCMetrics() []string {
164 return withBaseMetrics([]string{
165 + "go_gc_cleanups_executed_cleanups_total",
166 + "go_gc_cleanups_queued_cleanups_total",
167 "go_gc_cycles_automatic_gc_cycles_total",
168 "go_gc_cycles_forced_gc_cycles_total",
169 "go_gc_cycles_total_gc_cycles_total",
170 + "go_gc_finalizers_executed_finalizers_total",
171 + "go_gc_finalizers_queued_finalizers_total",
172 "go_gc_gogc_percent",
173 "go_gc_gomemlimit_bytes",
174 "go_gc_heap_allocs_by_size_bytes",
175 @@ -168,12 +186,18 @@ func withMemoryMetrics() []string {
176 func withSchedulerMetrics() []string {
177 return withBaseMetrics([]string{
178 "go_sched_gomaxprocs_threads",
179 + "go_sched_goroutines_created_goroutines_total",
180 "go_sched_goroutines_goroutines",
181 + "go_sched_goroutines_not_in_go_goroutines",
182 + "go_sched_goroutines_runnable_goroutines",
183 + "go_sched_goroutines_running_goroutines",
184 + "go_sched_goroutines_waiting_goroutines",
185 "go_sched_latencies_seconds",
186 "go_sched_pauses_stopping_gc_seconds",
187 "go_sched_pauses_stopping_other_seconds",
188 "go_sched_pauses_total_gc_seconds",
189 "go_sched_pauses_total_other_seconds",
190 + "go_sched_threads_total_threads",
191 })
192 }
193
194 @@ -182,6 +206,7 @@ func withDebugMetrics() []string {
195 "go_godebug_non_default_behavior_allowmultiplevcs_events_total",
196 "go_godebug_non_default_behavior_asynctimerchan_events_total",
197 "go_godebug_non_default_behavior_containermaxprocs_events_total",
198 + "go_godebug_non_default_behavior_cryptocustomrand_events_total",
199 "go_godebug_non_default_behavior_embedfollowsymlinks_events_total",
200 "go_godebug_non_default_behavior_execerrdot_events_total",
201 "go_godebug_non_default_behavior_gocachehash_events_total",
202 @@ -189,6 +214,7 @@ func withDebugMetrics() []string {
203 "go_godebug_non_default_behavior_gocacheverify_events_total",
204 "go_godebug_non_default_behavior_gotestjsonbuildtext_events_total",
205 "go_godebug_non_default_behavior_gotypesalias_events_total",
206 + "go_godebug_non_default_behavior_htmlmetacontenturlescape_events_total",
207 "go_godebug_non_default_behavior_http2client_events_total",
208 "go_godebug_non_default_behavior_http2server_events_total",
209 "go_godebug_non_default_behavior_httpcookiemaxnum_events_total",
210 @@ -212,6 +238,8 @@ func withDebugMetrics() []string {
211 "go_godebug_non_default_behavior_tlssha1_events_total",
212 "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
213 "go_godebug_non_default_behavior_updatemaxprocs_events_total",
214 + "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
215 + "go_godebug_non_default_behavior_urlstrictcolons_events_total",
216 "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
217 "go_godebug_non_default_behavior_winsymlink_events_total",
218 "go_godebug_non_default_behavior_x509keypairleaf_events_total",
219 diff --git a/prometheus/go_collector_metrics_go124_test.go b/prometheus/go_collector_metrics_go124_test.go
220 index 75c55aa..d900fbc 100644
221 --- a/prometheus/go_collector_metrics_go124_test.go
222 +++ b/prometheus/go_collector_metrics_go124_test.go
223 @@ -71,6 +71,7 @@ var (
224 "/godebug/non-default-behavior/tlsmaxrsasize:events": "go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
225 "/godebug/non-default-behavior/tlsrsakex:events": "go_godebug_non_default_behavior_tlsrsakex_events_total",
226 "/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
227 + "/godebug/non-default-behavior/urlmaxqueryparams:events": "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
228 "/godebug/non-default-behavior/winreadlinkvolume:events": "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
229 "/godebug/non-default-behavior/winsymlink:events": "go_godebug_non_default_behavior_winsymlink_events_total",
230 "/godebug/non-default-behavior/x509keypairleaf:events": "go_godebug_non_default_behavior_x509keypairleaf_events_total",
231 @@ -110,4 +111,4 @@ var (
232 }
233 )
234
235 -const expectedRuntimeMetricsCardinality = 173
236 +const expectedRuntimeMetricsCardinality = 174
237 diff --git a/prometheus/go_collector_metrics_go125_test.go b/prometheus/go_collector_metrics_go125_test.go
238 index e0276a2..5662580 100644
239 --- a/prometheus/go_collector_metrics_go125_test.go
240 +++ b/prometheus/go_collector_metrics_go125_test.go
241 @@ -75,6 +75,7 @@ var (
242 "/godebug/non-default-behavior/tlssha1:events": "go_godebug_non_default_behavior_tlssha1_events_total",
243 "/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
244 "/godebug/non-default-behavior/updatemaxprocs:events": "go_godebug_non_default_behavior_updatemaxprocs_events_total",
245 + "/godebug/non-default-behavior/urlmaxqueryparams:events": "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
246 "/godebug/non-default-behavior/winreadlinkvolume:events": "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
247 "/godebug/non-default-behavior/winsymlink:events": "go_godebug_non_default_behavior_winsymlink_events_total",
248 "/godebug/non-default-behavior/x509keypairleaf:events": "go_godebug_non_default_behavior_x509keypairleaf_events_total",
249 @@ -115,4 +116,4 @@ var (
250 }
251 )
252
253 -const expectedRuntimeMetricsCardinality = 178
254 +const expectedRuntimeMetricsCardinality = 179
255 diff --git a/prometheus/go_collector_metrics_go125_test.go b/prometheus/go_collector_metrics_go126_test.go
256 similarity index 86%
257 copy from prometheus/go_collector_metrics_go125_test.go
258 copy to prometheus/go_collector_metrics_go126_test.go
259 index e0276a2..c1b582c 100644
260 --- a/prometheus/go_collector_metrics_go125_test.go
261 +++ b/prometheus/go_collector_metrics_go126_test.go
262 @@ -1,8 +1,8 @@
263 // Code generated by gen_go_collector_metrics_set.go; DO NOT EDIT.
264 -//go:generate go run gen_go_collector_metrics_set.go go1.25
265 +//go:generate go run gen_go_collector_metrics_set.go go1.26
266
267 -//go:build go1.25 && !go1.26
268 -// +build go1.25,!go1.26
269 +//go:build go1.26 && !go1.27
270 +// +build go1.26,!go1.27
271
272 package prometheus
273
274 @@ -20,9 +20,13 @@ var (
275 "/cpu/classes/scavenge/total:cpu-seconds": "go_cpu_classes_scavenge_total_cpu_seconds_total",
276 "/cpu/classes/total:cpu-seconds": "go_cpu_classes_total_cpu_seconds_total",
277 "/cpu/classes/user:cpu-seconds": "go_cpu_classes_user_cpu_seconds_total",
278 + "/gc/cleanups/executed:cleanups": "go_gc_cleanups_executed_cleanups_total",
279 + "/gc/cleanups/queued:cleanups": "go_gc_cleanups_queued_cleanups_total",
280 "/gc/cycles/automatic:gc-cycles": "go_gc_cycles_automatic_gc_cycles_total",
281 "/gc/cycles/forced:gc-cycles": "go_gc_cycles_forced_gc_cycles_total",
282 "/gc/cycles/total:gc-cycles": "go_gc_cycles_total_gc_cycles_total",
283 + "/gc/finalizers/executed:finalizers": "go_gc_finalizers_executed_finalizers_total",
284 + "/gc/finalizers/queued:finalizers": "go_gc_finalizers_queued_finalizers_total",
285 "/gc/gogc:percent": "go_gc_gogc_percent",
286 "/gc/gomemlimit:bytes": "go_gc_gomemlimit_bytes",
287 "/gc/heap/allocs-by-size:bytes": "go_gc_heap_allocs_by_size_bytes",
288 @@ -45,6 +49,7 @@ var (
289 "/godebug/non-default-behavior/allowmultiplevcs:events": "go_godebug_non_default_behavior_allowmultiplevcs_events_total",
290 "/godebug/non-default-behavior/asynctimerchan:events": "go_godebug_non_default_behavior_asynctimerchan_events_total",
291 "/godebug/non-default-behavior/containermaxprocs:events": "go_godebug_non_default_behavior_containermaxprocs_events_total",
292 + "/godebug/non-default-behavior/cryptocustomrand:events": "go_godebug_non_default_behavior_cryptocustomrand_events_total",
293 "/godebug/non-default-behavior/embedfollowsymlinks:events": "go_godebug_non_default_behavior_embedfollowsymlinks_events_total",
294 "/godebug/non-default-behavior/execerrdot:events": "go_godebug_non_default_behavior_execerrdot_events_total",
295 "/godebug/non-default-behavior/gocachehash:events": "go_godebug_non_default_behavior_gocachehash_events_total",
296 @@ -52,6 +57,7 @@ var (
297 "/godebug/non-default-behavior/gocacheverify:events": "go_godebug_non_default_behavior_gocacheverify_events_total",
298 "/godebug/non-default-behavior/gotestjsonbuildtext:events": "go_godebug_non_default_behavior_gotestjsonbuildtext_events_total",
299 "/godebug/non-default-behavior/gotypesalias:events": "go_godebug_non_default_behavior_gotypesalias_events_total",
300 + "/godebug/non-default-behavior/htmlmetacontenturlescape:events": "go_godebug_non_default_behavior_htmlmetacontenturlescape_events_total",
301 "/godebug/non-default-behavior/http2client:events": "go_godebug_non_default_behavior_http2client_events_total",
302 "/godebug/non-default-behavior/http2server:events": "go_godebug_non_default_behavior_http2server_events_total",
303 "/godebug/non-default-behavior/httpcookiemaxnum:events": "go_godebug_non_default_behavior_httpcookiemaxnum_events_total",
304 @@ -75,6 +81,8 @@ var (
305 "/godebug/non-default-behavior/tlssha1:events": "go_godebug_non_default_behavior_tlssha1_events_total",
306 "/godebug/non-default-behavior/tlsunsafeekm:events": "go_godebug_non_default_behavior_tlsunsafeekm_events_total",
307 "/godebug/non-default-behavior/updatemaxprocs:events": "go_godebug_non_default_behavior_updatemaxprocs_events_total",
308 + "/godebug/non-default-behavior/urlmaxqueryparams:events": "go_godebug_non_default_behavior_urlmaxqueryparams_events_total",
309 + "/godebug/non-default-behavior/urlstrictcolons:events": "go_godebug_non_default_behavior_urlstrictcolons_events_total",
310 "/godebug/non-default-behavior/winreadlinkvolume:events": "go_godebug_non_default_behavior_winreadlinkvolume_events_total",
311 "/godebug/non-default-behavior/winsymlink:events": "go_godebug_non_default_behavior_winsymlink_events_total",
312 "/godebug/non-default-behavior/x509keypairleaf:events": "go_godebug_non_default_behavior_x509keypairleaf_events_total",
313 @@ -99,12 +107,18 @@ var (
314 "/memory/classes/profiling/buckets:bytes": "go_memory_classes_profiling_buckets_bytes",
315 "/memory/classes/total:bytes": "go_memory_classes_total_bytes",
316 "/sched/gomaxprocs:threads": "go_sched_gomaxprocs_threads",
317 + "/sched/goroutines-created:goroutines": "go_sched_goroutines_created_goroutines_total",
318 + "/sched/goroutines/not-in-go:goroutines": "go_sched_goroutines_not_in_go_goroutines",
319 + "/sched/goroutines/runnable:goroutines": "go_sched_goroutines_runnable_goroutines",
320 + "/sched/goroutines/running:goroutines": "go_sched_goroutines_running_goroutines",
321 + "/sched/goroutines/waiting:goroutines": "go_sched_goroutines_waiting_goroutines",
322 "/sched/goroutines:goroutines": "go_sched_goroutines_goroutines",
323 "/sched/latencies:seconds": "go_sched_latencies_seconds",
324 "/sched/pauses/stopping/gc:seconds": "go_sched_pauses_stopping_gc_seconds",
325 "/sched/pauses/stopping/other:seconds": "go_sched_pauses_stopping_other_seconds",
326 "/sched/pauses/total/gc:seconds": "go_sched_pauses_total_gc_seconds",
327 "/sched/pauses/total/other:seconds": "go_sched_pauses_total_other_seconds",
328 + "/sched/threads/total:threads": "go_sched_threads_total_threads",
329 "/sync/mutex/wait/total:seconds": "go_sync_mutex_wait_total_seconds_total",
330 }
331
332 @@ -115,4 +129,4 @@ var (
333 }
334 )
335
336 -const expectedRuntimeMetricsCardinality = 178
337 +const expectedRuntimeMetricsCardinality = 192
338 diff --git a/prometheus/timer_test.go b/prometheus/timer_test.go
339 index a27912d..ce284e8 100644
340 --- a/prometheus/timer_test.go
341 +++ b/prometheus/timer_test.go
342 @@ -16,6 +16,7 @@ package prometheus
343 import (
344 "reflect"
345 "testing"
346 + "time"
347
348 "google.golang.org/protobuf/proto"
349
350 @@ -36,6 +37,8 @@ func TestTimerObserve(t *testing.T) {
351 defer hisTimer.ObserveDuration()
352 defer sumTimer.ObserveDuration()
353 defer gaugeTimer.ObserveDuration()
354 + // Ensure measurable time passes to avoid flaky test on fast systems.
355 + time.Sleep(time.Millisecond)
356 }()
357
358 m := &dto.Metric{}
359 @@ -71,6 +74,8 @@ func TestTimerObserveWithExemplar(t *testing.T) {
360 // Gauges and summaries does not implement ExemplarObserver, so we expect them to ignore exemplar.
361 defer sumTimer.ObserveDurationWithExemplar(exemplar)
362 defer gaugeTimer.ObserveDurationWithExemplar(exemplar)
363 + // Ensure measurable time passes to avoid flaky test on fast systems.
364 + time.Sleep(time.Millisecond)
365 }()
366
367 m := &dto.Metric{}