added prometheus route

This commit is contained in:
Stephen McQuay 2016-09-25 15:24:14 -07:00
parent a0ca983b45
commit abe0e155a9
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

View File

@ -11,6 +11,7 @@ import (
"github.com/elazarl/go-bindata-assetfs" "github.com/elazarl/go-bindata-assetfs"
"github.com/gorilla/sessions" "github.com/gorilla/sessions"
"github.com/prometheus/client_golang/prometheus"
) )
//go:generate go-bindata -o static.go static/ //go:generate go-bindata -o static.go static/
@ -24,6 +25,7 @@ var store = sessions.NewCookieStore([]byte(os.Getenv("MMG_SECRET_KEY")))
func main() { func main() {
rand.Seed(time.Now().UTC().UnixNano()) rand.Seed(time.Now().UTC().UnixNano())
flag.Parse() flag.Parse()
http.Handle("/metrics", prometheus.Handler())
http.HandleFunc("/api/v0/addsub/problem/", addsub) http.HandleFunc("/api/v0/addsub/problem/", addsub)
http.HandleFunc("/api/v0/mul/problem/", mul) http.HandleFunc("/api/v0/mul/problem/", mul)
http.HandleFunc("/api/v0/attempt/", attempt) http.HandleFunc("/api/v0/attempt/", attempt)