On 15.09.21 19:45, kaka LI wrote: > 1. How to explain why all programs need to start promhttp.Handler() to > expose indicators? Is it a best practice?
It's not just best practice, it is _the_ way how Prometheus collects metrics: The Prometheus server scrapes the monitored targets via HTTP, so all targets that want to be monitored have to serve HTTP somehow. In Go, programs will usually use the Go net/http package for that, and that package defines the http.Handler type etc. In other languages, you use whatever tools are available to serve HTTP. In many cases, the monitored targets already serve HTTP as part of their production work load. In that case, you can either expose the metrics via a separate path (`/metrics` is indeed just a convention, any path will do), or you open a separate HTTP socket. -- Björn Rabenstein [PGP-ID] 0x851C3DA17D748D03 [email] [email protected] -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/20210916170905.GH3692%40jahnn.

