runtime/metrics: change unit on *-by-size metrics to match bucket unit

This change modifies the *-by-size metrics' units to be based off the
bucket's unit (bytes) as opposed to the unit of the counts (objects).
This convention is more in-line with distributions in other metrics
systems.

Change-Id: Id3b68a09f52f0e1ff9f4346f613ae1cbd9f52f73
Reviewed-on: https://go-review.googlesource.com/c/go/+/282352
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Michael Anthony Knyszek 2021-01-07 17:24:39 +00:00 committed by Michael Knyszek
parent c6513bca5a
commit 32afcc9436
4 changed files with 15 additions and 10 deletions

View file

@ -23,6 +23,11 @@ type Description struct {
// Examples of units might be "seconds", "bytes", "bytes/second", "cpu-seconds",
// "byte*cpu-seconds", and "bytes/second/second".
//
// For histograms, multiple units may apply. For instance, the units of the buckets and
// the count. By convention, for histograms, the units of the count are always "samples"
// with the type of sample evident by the metric's name, while the unit in the name
// specifies the buckets' unit.
//
// A complete name might look like "/memory/heap/free:bytes".
Name string
@ -69,12 +74,12 @@ var allDesc = []Description{
Cumulative: true,
},
{
Name: "/gc/heap/allocs-by-size:objects",
Name: "/gc/heap/allocs-by-size:bytes",
Description: "Distribution of all objects allocated by approximate size.",
Kind: KindFloat64Histogram,
},
{
Name: "/gc/heap/frees-by-size:objects",
Name: "/gc/heap/frees-by-size:bytes",
Description: "Distribution of all objects freed by approximate size.",
Kind: KindFloat64Histogram,
},