mirror of
https://github.com/foomo/contentserver.git
synced 2025-10-16 12:25:44 +00:00
21 lines
458 B
Go
21 lines
458 B
Go
package metrics
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/foomo/contentserver/log"
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
)
|
|
|
|
func PrometheusHandler() http.Handler {
|
|
h := http.NewServeMux()
|
|
h.Handle("/metrics", promhttp.Handler())
|
|
return h
|
|
}
|
|
|
|
func RunPrometheusHandler(listener string) {
|
|
log.Notice(fmt.Sprintf("starting prometheus handler on address '%s'", listener))
|
|
log.Error(http.ListenAndServe(listener, PrometheusHandler()))
|
|
}
|