aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/metrics
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2020-08-07 16:28:35 +0000
committerMichael Pratt <mpratt@google.com>2021-04-23 13:48:10 +0000
commitbedfeed54a7a80123c07f83c325a0bcfe5c43398 (patch)
treee3cd3332028b2bd64350701f5957b5cfbc0beb3d /src/runtime/metrics
parent105a6e9518a5195950a2798769af6e86b6d87417 (diff)
downloadgo-bedfeed54a7a80123c07f83c325a0bcfe5c43398.tar.gz
go-bedfeed54a7a80123c07f83c325a0bcfe5c43398.zip
runtime,runtime/metrics: add metric to track scheduling latencies
This change adds a metric to track scheduling latencies, defined as the cumulative amount of time a goroutine spends being runnable before running again. The metric is an approximations and samples instead of trying to record every goroutine scheduling latency. This change was primarily authored by mknyszek@google.com. Change-Id: Ie0be7e6e7be421572eb2317d3dd8dd6f3d6aa152 Reviewed-on: https://go-review.googlesource.com/c/go/+/308933 Trust: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/metrics')
-rw-r--r--src/runtime/metrics/description.go5
-rw-r--r--src/runtime/metrics/doc.go4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime/metrics/description.go b/src/runtime/metrics/description.go
index 1175156104..9aaf457135 100644
--- a/src/runtime/metrics/description.go
+++ b/src/runtime/metrics/description.go
@@ -176,6 +176,11 @@ var allDesc = []Description{
Description: "Count of live goroutines.",
Kind: KindUint64,
},
+ {
+ Name: "/sched/latencies:seconds",
+ Description: "Distribution of the time goroutines have spent in the scheduler in a runnable state before actually running.",
+ Kind: KindFloat64Histogram,
+ },
}
// All returns a slice of containing metric descriptions for all supported metrics.
diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go
index 7f790afc12..7cbc0415dc 100644
--- a/src/runtime/metrics/doc.go
+++ b/src/runtime/metrics/doc.go
@@ -139,5 +139,9 @@ Below is the full list of supported metrics, ordered lexicographically.
/sched/goroutines:goroutines
Count of live goroutines.
+
+ /sched/latencies:seconds
+ Distribution of the time goroutines have spent in the scheduler
+ in a runnable state before actually running.
*/
package metrics