enable open matrics.

Let Prometheus decide which to keep.
This commit is contained in:
Shizun Ge 2024-01-13 19:41:30 -08:00
parent c198541542
commit d471db7f6c

View file

@ -98,7 +98,7 @@ func initPrometheus(prometheusHost, prometheusPort, prometheusEntry string) {
promReg.MustRegister(totalSeconds) promReg.MustRegister(totalSeconds)
promReg.MustRegister(clientIP) promReg.MustRegister(clientIP)
promReg.MustRegister(clientSeconds) promReg.MustRegister(clientSeconds)
handler := promhttp.HandlerFor(promReg, promhttp.HandlerOpts{EnableOpenMetrics: false}) handler := promhttp.HandlerFor(promReg, promhttp.HandlerOpts{EnableOpenMetrics: true})
http.Handle("/"+prometheusEntry, handler) http.Handle("/"+prometheusEntry, handler)
go func() { go func() {
glog.Infof("Starting Prometheus on %v:%v, entry point is /%v", prometheusHost, prometheusPort, prometheusEntry) glog.Infof("Starting Prometheus on %v:%v, entry point is /%v", prometheusHost, prometheusPort, prometheusEntry)