List the metrics available in Prometheus

Use the label-values API to list metric names, narrow results by job, inspect exporter output, and distinguish retained data from current series.

Best practices
Metrics monitoring and troubleshooting

Use /api/v1/label/__name__/values to list metric names known to Prometheus. The __name__ label holds the metric name. This endpoint is a better starting point than requesting every stored series in a large installation.

Browse or request metric names

The Prometheus expression browser offers metric-name suggestions as you type. For a machine-readable list:

curl -fsS http://localhost:9090/api/v1/label/__name__/values | jq .

The result lists names, not the current values or every label combination. Metadata APIs can include retained series with no sample at the current evaluation time. Use time bounds and matchers when you need a narrower inventory.

To restrict the names to one job:

curl -fsSG http://localhost:9090/api/v1/label/__name__/values \
  --data-urlencode 'match[]={job="node"}' | jq .

Use the authentication and HTTPS settings required by your deployment when querying a remote server.

See which metrics currently have samples

count by (__name__) ({job="node"})

This returns one result per metric name and counts its selected series at the evaluation time. It differs from a retained metadata inventory. A selector such as {__name__=~".+"} can select all currently available series, but the result may be very large and expensive.

Inspect an exporter's endpoint

Open Prometheus's Targets page and find the target's scrape URL. Request that URL from an authorized network location to inspect the exposed samples, HELP descriptions, and TYPE declarations.

The target may use a custom path, HTTPS, or authentication. Prometheus's own /metrics endpoint contains metrics about Prometheus itself; it does not dump every metric collected from other targets.

Find high-cardinality metric names

topk(20, count by (__name__) ({__name__=~".+"}))

This ranks names by the number of currently selected series. Scope it to a job or another useful boundary first on a busy server. It measures series count, not directly memory usage or the total number of historical series.

FAQ

Why do some metrics disappear? Instant queries stop returning stale series. A stopped target or an exporter that stops exposing a metric can cause this. Earlier samples remain queryable within retention, so absence from an instant query does not mean the historical data was deleted.

Is a metric name a label? Yes. PromQL represents it as __name__, which is why label matching and the label-values API can operate on names.

Sources

This guide is based on the documentation below; the examples have not been tested against a live deployment.

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting