Added prom metrics route
This commit is contained in:
parent
2f0c01df7a
commit
6fa26ec095
@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"mcquay.me/hwt"
|
||||
pb "mcquay.me/hwt/rpc/hwt"
|
||||
)
|
||||
@ -16,7 +17,10 @@ func main() {
|
||||
}
|
||||
s := &hwt.Server{hn}
|
||||
th := pb.NewHelloWorldServer(s, nil)
|
||||
if err := http.ListenAndServe(":8080", th); err != nil {
|
||||
sm := http.NewServeMux()
|
||||
sm.Handle("/", th)
|
||||
sm.Handle("/metrics", promhttp.Handler())
|
||||
if err := http.ListenAndServe(":8080", sm); err != nil {
|
||||
log.Fatalf("listen and serve: %v", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user