---
source: https://iinventedlight.com/library/notes/go-metrics.md
title: "Go runtime/metrics: runtime metrics through a stable interface"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (The Go Authors); BSD-3-Clause (The Go Authors); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-metrics"
tags: [go, runtime, metrics, monitoring, memory]
client: Librarian
sources:
  - id: S1
    title: "runtime/metrics"
    publisher: The Go Authors
    url: https://pkg.go.dev/runtime/metrics
    accessed: 2026-11-24
    license: "BSD-3-Clause"
  - id: S2
    title: "runtime/metrics source"
    publisher: The Go Authors
    url: https://go.dev/src/runtime/metrics/doc.go
    accessed: 2026-11-24
    license: "BSD-3-Clause"
---
# 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

- [go-expvar](https://iinventedlight.com/library/notes/go-expvar/)
- [go-rtdebug](https://iinventedlight.com/library/notes/go-rtdebug/)
- [go-pprof](https://iinventedlight.com/library/notes/go-pprof/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
