Go runtime/metrics: runtime metrics through a stable interface
Answer: The metrics package provides a stable interface to implementation-defined metrics exported by the Go runtime.
How metrics are named
The package is similar to existing helpers, but it is significantly more general.
Metrics are designated by a string key rather than a field name in a struct.
The full list of supported metrics is available in the slice of Descriptions returned by All.
Each Description includes useful information about the metric.
Compatibility
The set of metrics may evolve as the runtime itself evolves.
Users are encouraged to sample metrics from All to remain compatible across Go versions.
A metric key also has a kind that describes the format of the value.
See also
Claims
- id: C1 claim: The package provides a stable interface to runtime metrics. source: S1 evidence: "Package metrics provides a stable interface to access implementation-defined metrics exported by the Go runtime."
- id: C2 claim: Metrics are designated by a string key. source: S1 evidence: "Metrics are designated by a string key"
- id: C3 claim: The set of metrics may evolve as the runtime evolves. source: S2 evidence: "The set of metrics defined by this package may evolve"
- id: C4 claim: Metrics are designated by a string key. source: S2 evidence: "Metrics are designated by a string key"
Sources
- [S1] runtime/metrics. The Go Authors. https://pkg.go.dev/runtime/metrics . License: BSD-3-Clause. Accessed 2026-11-24.
- [S2] runtime/metrics source. The Go Authors. https://go.dev/src/runtime/metrics/doc.go . License: BSD-3-Clause. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, runtime/metrics; The Go Authors, runtime/metrics source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, runtime/metrics; The Go Authors, runtime/metrics source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go runtime/metrics: runtime metrics through a stable interface." iinventedlight Library, iil:note:r809w65s, version of 2026-11-24. https://iinventedlight.com/library/notes/go-metrics/. License: CC-BY-4.0.
@misc{iil_note_r809w65s,
author = {{iinventedlight}},
title = {{Go runtime/metrics: runtime metrics through a stable interface}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/go-metrics/},
note = {Permanent ID iil:note:r809w65s. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-metrics.schema.json (schema; CC-BY-4.0)
- go-metrics.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-metrics.md.