1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-27 19:12:07 +02:00

Monitoring is an internal package

This commit is contained in:
Alexandre Iooss
2020-09-21 21:38:11 +02:00
parent 7cdd78a70e
commit c799a5b613
3 changed files with 2 additions and 2 deletions

View File

@ -0,0 +1,27 @@
package monitoring
import (
"log"
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"gitlab.crans.org/nounous/ghostream/internal/config"
)
var (
// ViewerServed is the total amount of viewer page served
ViewerServed = promauto.NewCounter(prometheus.CounterOpts{
Name: "ghostream_viewer_served_total",
Help: "The total amount of viewer served",
})
)
// ServeHTTP server that expose prometheus metrics
func ServeHTTP(cfg *config.Config) {
mux := http.NewServeMux()
mux.Handle("/metrics", promhttp.Handler())
log.Printf("Monitoring listening on http://%s/", cfg.Prometheus.ListenAddress)
log.Fatal(http.ListenAndServe(cfg.Prometheus.ListenAddress, mux))
}