← All notes

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

Sources

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

Permanent ID: iil:note:r809w65s

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.},
}

Markdown

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.

All artifact files (JSON index)

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.