From 8b51eb5199031f64f1de811deeab2979f59ad7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisend=C3=B6rfer?= <felix.geisendoerfer@datadoghq.com> Date: Tue, 23 May 2023 12:30:43 +0200 Subject: [PATCH] runtime/metrics: add /gc/scan/stack:bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- src/runtime/metrics.go | 6 ++++++ src/runtime/metrics/description.go | 5 +++++ src/runtime/metrics/doc.go | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/runtime/metrics.go b/src/runtime/metrics.go index 4931a0ef8b8..ffbb4e4d0f4 100644 --- a/src/runtime/metrics.go +++ b/src/runtime/metrics.go @@ -300,6 +300,12 @@ func initMetrics() { 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": { compute: func(in *statAggregate, out *metricValue) { out.kind = metricKindUint64 diff --git a/src/runtime/metrics/description.go b/src/runtime/metrics/description.go index e3eb87b353b..8355fc5da04 100644 --- a/src/runtime/metrics/description.go +++ b/src/runtime/metrics/description.go @@ -294,6 +294,11 @@ var allDesc = []Description{ Kind: KindFloat64Histogram, 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", Description: "The stack size of new goroutines.", diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go index f95177edc85..7f212784507 100644 --- a/src/runtime/metrics/doc.go +++ b/src/runtime/metrics/doc.go @@ -216,6 +216,9 @@ Below is the full list of supported metrics, ordered lexicographically. Distribution of individual GC-related stop-the-world pause 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 The stack size of new goroutines. -- GitLab