Skip to content

Commit 5020724

Browse files
authored
internal/plot: add goroutines plot for !go1.26 (#145)
The various metrics which break down the goroutines by state have been added in go1.26. Before that we only had `/sched/goroutines:goroutine` which was removed in a precedent commit.
1 parent 562f9ea commit 5020724

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//go:build !go1.26
2+
3+
package plot
4+
5+
import (
6+
"runtime/metrics"
7+
"time"
8+
)
9+
10+
var _ = register(description{
11+
metrics: []string{
12+
"/sched/goroutines:goroutines",
13+
},
14+
getvalues: func() getvalues {
15+
return func(_ time.Time, samples []metrics.Sample) any {
16+
goroutines := samples[idx_sched_goroutines_goroutines].Value.Uint64()
17+
return []uint64{goroutines}
18+
}
19+
},
20+
21+
layout: Scatter{
22+
Name: "goroutines",
23+
Tags: []tag{tagScheduler},
24+
Title: "Goroutines",
25+
Type: "scatter",
26+
Layout: ScatterLayout{
27+
Yaxis: ScatterYAxis{
28+
Title: "goroutines",
29+
},
30+
},
31+
Subplots: []Subplot{
32+
{Name: "goroutines", Unitfmt: "%{y}"},
33+
},
34+
InfoText: `<i>Goroutines</i> is <b>/sched/goroutines</b>, the count of live goroutines`,
35+
},
36+
})

0 commit comments

Comments
 (0)