fix: add /metrics handler and stop logging

This commit is contained in:
Dominic Evans
2021-05-13 10:11:32 +01:00
parent baf88bdc78
commit 10827cf62e

View File

@@ -2,11 +2,10 @@ package rest
import ( import (
"context" "context"
"github.com/gorilla/handlers" "net/http"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"net/http"
"os"
) )
type Server struct { type Server struct {
@@ -17,11 +16,12 @@ func New(bind string) *Server {
var s Server var s Server
r := http.NewServeMux() r := http.NewServeMux()
r.Handle("/metrics", promhttp.Handler())
r.Handle("/prometheus", promhttp.Handler()) r.Handle("/prometheus", promhttp.Handler())
server := http.Server{ server := http.Server{
Addr: bind, Addr: bind,
Handler: handlers.LoggingHandler(os.Stdout, r), Handler: r,
} }
s.httpSrv = &server s.httpSrv = &server