-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go collector: add default metrics acceptance tests; adding more context to HELP #1568
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,21 +22,21 @@ import ( | |
// goRuntimeMemStats provides the metrics initially provided by runtime.ReadMemStats. | ||
// From Go 1.17 those similar (and better) statistics are provided by runtime/metrics, so | ||
// while eval closure works on runtime.MemStats, the struct from Go 1.17+ is | ||
// populated using runtime/metrics. | ||
// populated using runtime/metrics. Those are the defaults we can't alter. | ||
func goRuntimeMemStats() memStatsMetrics { | ||
return memStatsMetrics{ | ||
{ | ||
desc: NewDesc( | ||
memstatNamespace("alloc_bytes"), | ||
"Number of bytes allocated and still in use.", | ||
"Number of bytes allocated and currently in use.", | ||
nil, nil, | ||
), | ||
eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) }, | ||
valType: GaugeValue, | ||
}, { | ||
desc: NewDesc( | ||
memstatNamespace("alloc_bytes_total"), | ||
"Total number of bytes allocated, even if freed.", | ||
"Total number of bytes allocated until now, even if released already.", | ||
nil, nil, | ||
), | ||
eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) }, | ||
|
@@ -60,23 +60,24 @@ func goRuntimeMemStats() memStatsMetrics { | |
}, { | ||
desc: NewDesc( | ||
memstatNamespace("mallocs_total"), | ||
"Total number of mallocs.", | ||
// TODO(bwplotka): We could add go_memstats_heap_objects, probably useful for discovery. Let's gather more feedback, kind of waste of bytes for everybody for compatibility reason. | ||
"Total number of heap objects allocated, semantically a counter version for go_memstats_heap_objects gauge.", | ||
bwplotka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
nil, nil, | ||
), | ||
eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) }, | ||
valType: CounterValue, | ||
}, { | ||
desc: NewDesc( | ||
memstatNamespace("frees_total"), | ||
"Total number of frees.", | ||
"Total number of heap objects frees.", | ||
nil, nil, | ||
), | ||
eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) }, | ||
valType: CounterValue, | ||
}, { | ||
desc: NewDesc( | ||
memstatNamespace("heap_alloc_bytes"), | ||
"Number of heap bytes allocated and still in use.", | ||
"Number of heap bytes allocated and currently in use.", | ||
nil, nil, | ||
), | ||
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) }, | ||
|
@@ -116,7 +117,7 @@ func goRuntimeMemStats() memStatsMetrics { | |
}, { | ||
desc: NewDesc( | ||
memstatNamespace("heap_objects"), | ||
"Number of allocated objects.", | ||
"Number of currently allocated objects.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether here we could add something to the effect of "(regardless of released)" (like in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, so this is current number, so it does not include released objects. Did you mean to add more details on some the exact description for those, we could add that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, it should be for the counter version, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you propose a description that you want? (: |
||
nil, nil, | ||
), | ||
eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) }, | ||
|
@@ -225,7 +226,7 @@ func newBaseGoCollector() baseGoCollector { | |
nil, nil), | ||
gcDesc: NewDesc( | ||
"go_gc_duration_seconds", | ||
"A summary of the pause duration of garbage collection cycles.", | ||
"A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.", | ||
bwplotka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
nil, nil), | ||
gcLastTimeDesc: NewDesc( | ||
"go_memstats_last_gc_time_seconds", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose
"Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge."
Apologies for the lack of clarity :)