Metrics list golang

382 views
Skip to first unread message

Sotirios Mantziaris

unread,
Sep 7, 2018, 6:53:17 AM9/7/18
to Prometheus Users
Hi,

is it possible to get a list of registered metrics from the go client library?
I am interested in getting a list of metric name, description in order to expose them through a status page of my service.

thanks 

Chris Marchbanks

unread,
Sep 7, 2018, 3:09:35 PM9/7/18
to smant...@gmail.com, Prometheus Users
Hi Sotirios,

You can use the Gather method on a Registry to return information on all of the registered metrics in Go. If you use the default registry, then you can use the default gatherer like:
metricFamilies, err := prometheus.DefaultGatherer.Gather()


Let me know if you have more questions!

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/4953f79b-afd4-41e4-853e-227f24b24e58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Chris Marchbanks | Engineer
FreshTracks.io - Intelligent Alerting for Kubernetes and Prometheus

Sotirios Mantziaris

unread,
Sep 7, 2018, 3:15:23 PM9/7/18
to Chris Marchbanks, Prometheus Users
Hi Chris,

I did find this too after a while.

thanks very much  
--
Kind Regards,

S. Mantziaris
Reply all
Reply to author
Forward
0 new messages