forked from mirror/client_golang
![]() This change introduces use of the runtime/metrics package in place of runtime.MemStats for Go 1.17 or later. The runtime/metrics package was introduced in Go 1.16, but not all the old metrics were accounted for until 1.17. The runtime/metrics package offers several advantages over using runtime.MemStats: * The list of metrics and their descriptions are machine-readable, allowing new metrics to get added without any additional work. * Detailed histogram-based metrics are now available, offering much deeper insights into the Go runtime. * The runtime/metrics API is significantly more efficient than runtime.MemStats, even with the additional metrics added, because it does not require any stop-the-world events. That being said, integrating the package comes with some caveats, some of which were discussed in #842. Namely: * The old MemStats-based metrics need to continue working, so they're exported under their old names backed by equivalent runtime/metrics metrics. * Earlier versions of Go need to continue working, so the old code remains, but behind a build tag. Finally, a few notes about the implementation: * This change includes a whole bunch of refactoring to avoid significant code duplication. * This change adds a new histogram metric type specifically optimized for runtime/metrics histograms. This type's methods also include additional logic to deal with differences in bounds conventions. * This change makes a whole bunch of decisions about how runtime/metrics names are translated. * This change adds a `go generate` script to generate a list of expected runtime/metrics names for a given Go version for auditing. Users of new versions of Go will transparently be allowed to use new metrics, however. Signed-off-by: Michael Anthony Knyszek <mknyszek@google.com> |
||
---|---|---|
.. | ||
collectors | ||
graphite | ||
internal | ||
promauto | ||
promhttp | ||
push | ||
testutil | ||
.gitignore | ||
README.md | ||
benchmark_test.go | ||
build_info_collector.go | ||
collector.go | ||
collector_test.go | ||
counter.go | ||
counter_test.go | ||
desc.go | ||
desc_test.go | ||
doc.go | ||
example_clustermanager_test.go | ||
example_metricvec_test.go | ||
example_timer_complex_test.go | ||
example_timer_gauge_test.go | ||
example_timer_test.go | ||
examples_test.go | ||
expvar_collector.go | ||
expvar_collector_test.go | ||
fnv.go | ||
gauge.go | ||
gauge_test.go | ||
gen_go_collector_metrics_set.go | ||
go_collector.go | ||
go_collector_go116.go | ||
go_collector_go116_test.go | ||
go_collector_go117.go | ||
go_collector_go117_test.go | ||
go_collector_metrics_go117_test.go | ||
go_collector_test.go | ||
histogram.go | ||
histogram_test.go | ||
labels.go | ||
metric.go | ||
metric_test.go | ||
observer.go | ||
process_collector.go | ||
process_collector_other.go | ||
process_collector_test.go | ||
process_collector_windows.go | ||
process_collector_windows_test.go | ||
registry.go | ||
registry_test.go | ||
summary.go | ||
summary_test.go | ||
timer.go | ||
timer_test.go | ||
untyped.go | ||
value.go | ||
value_test.go | ||
vec.go | ||
vec_test.go | ||
wrap.go | ||
wrap_test.go |