runtime/metrics: add /gc/scan/stack:bytes

For #56857

Change-Id: I58187d7c4112b35951014ab14f2969bed7f4c8e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/497319
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Felix Geisendörfer 2023-05-23 12:30:43 +02:00 committed by Gopher Robot
parent 1eae5c160d
commit 8b51eb5199
3 changed files with 14 additions and 0 deletions

View file

@ -300,6 +300,12 @@ func initMetrics() {
hist.counts[len(hist.counts)-1] = memstats.gcPauseDist.overflow.Load() hist.counts[len(hist.counts)-1] = memstats.gcPauseDist.overflow.Load()
}, },
}, },
"/gc/scan/stack:bytes": {
compute: func(in *statAggregate, out *metricValue) {
out.kind = metricKindUint64
out.scalar = uint64(gcController.lastStackScan.Load())
},
},
"/gc/stack/starting-size:bytes": { "/gc/stack/starting-size:bytes": {
compute: func(in *statAggregate, out *metricValue) { compute: func(in *statAggregate, out *metricValue) {
out.kind = metricKindUint64 out.kind = metricKindUint64

View file

@ -294,6 +294,11 @@ var allDesc = []Description{
Kind: KindFloat64Histogram, Kind: KindFloat64Histogram,
Cumulative: true, Cumulative: true,
}, },
{
Name: "/gc/scan/stack:bytes",
Description: "The number of bytes of stack that were scanned last GC cycle.",
Kind: KindUint64,
},
{ {
Name: "/gc/stack/starting-size:bytes", Name: "/gc/stack/starting-size:bytes",
Description: "The stack size of new goroutines.", Description: "The stack size of new goroutines.",

View file

@ -216,6 +216,9 @@ Below is the full list of supported metrics, ordered lexicographically.
Distribution of individual GC-related stop-the-world pause Distribution of individual GC-related stop-the-world pause
latencies. Bucket counts increase monotonically. latencies. Bucket counts increase monotonically.
/gc/scan/stack:bytes
The number of bytes of stack that were scanned last GC cycle.
/gc/stack/starting-size:bytes /gc/stack/starting-size:bytes
The stack size of new goroutines. The stack size of new goroutines.