Add instrumentation with prometheus

This commit is contained in:
Las Zenow 2017-06-05 16:17:14 +00:00
parent 2a72154308
commit f4ca9e2dbc
6 changed files with 138 additions and 32 deletions

View file

@ -152,7 +152,7 @@ func UpdateLogger(loggerConfig string) error {
return log.ReplaceLogger(logger)
}
func InitRouter(db database.DB, sg *StatsGatherer, assetsPath string) {
func InitRouter(db database.DB, sg *StatsGatherer, assetsPath string) http.Handler {
const idPattern = "[0-9a-zA-Z\\-\\_]{16}"
r := mux.NewRouter()
@ -203,7 +203,7 @@ func InitRouter(db database.DB, sg *StatsGatherer, assetsPath string) {
r.HandleFunc("/news/edit", sg.Gather(editNewsHandler)).Methods("GET")
r.HandleFunc("/news/edit", sg.Gather(postNewsHandler)).Methods("POST")
http.Handle("/", r)
return r
}
func fileServer(servePath string, prefix string) func(w http.ResponseWriter, r *http.Request) {