How to use prometheus_client describe method?

26 views
Skip to first unread message

Elliott Balsley

unread,
Apr 3, 2025, 12:59:28 PMApr 3
to Prometheus Users
I'm working on a custom exporter, using the prometheus_client python library.  I've read the documentation about auto_describe but it's not clear.

With auto_describe=True, the collect() method runs twice on each scrape.  This is bad because it puts extra load on the target device.
I can fix this by adding a describe() method that returns an empty list.  That's easy, but I want to follow best practices.  Is there any reason I should return a proper list of metrics instead?

If I did want to implement a proper describe method, would it need to return a list of GaugeMetricFamily objects with name, help text, and labels?  It seems like a lot of duplicated code with the collect() method...  Are there any good example exporters to look at?

I'd be happy to hear any other feedback too since this is my first exporter.

Thanks!
Reply all
Reply to author
Forward
0 new messages