Tony.H
Tony.H

Reputation: 761

Prometheus endpoint of all available metrics

I was curious concerning the workings of Prometheus. Using the Prometheus interface I am able to see a drop-down list which I assume contains all available metrics. However, I am not able to access the metrics endpoint which lists all of the scraped metrics. The http://targethost:9090/metrics endpoint only displays the metrics concerning the Prometheus server itself. Is it possible to access a similar endpoint which lists all available metrics. I could perform a query based on {__name__=~".+"} but I would prefer to avoid this option.

Upvotes: 46

Views: 57990

Answers (2)

valyala
valyala

Reputation: 18084

Prometheus provides /federate API, which can be used for returning all the scraped metrics. For example, the following curl query returns all the metrics in Prometheus text exposition format (e.g. in the same format as /metrics output), which were scraped recently:

curl -G http://demo.robustperception.io:9090/federate -d 'match[]={__name__!=""}'

P.S. VictoriaMetrics supports additional start and end query args, which can be used for returning metrics scraped at a specific time range - see these docs.

Upvotes: 4

vinodk
vinodk

Reputation: 839

The endpoint for that is http://localhost:9090/api/v1/label/__name__/values

API Reference

Upvotes: 63

Related Questions