Use client_golang.exp for automatic telemetry.

This commit is contained in:
Johannes 'fish' Ziemke 2013-04-05 13:24:50 +02:00
parent 3aead8468c
commit 1c091a9723
1 changed files with 9 additions and 8 deletions

View File

@ -17,6 +17,7 @@ import (
"code.google.com/p/gorest" "code.google.com/p/gorest"
"flag" "flag"
"github.com/prometheus/client_golang" "github.com/prometheus/client_golang"
"github.com/prometheus/client_golang/exp"
"github.com/prometheus/prometheus/appstate" "github.com/prometheus/prometheus/appstate"
"github.com/prometheus/prometheus/web/api" "github.com/prometheus/prometheus/web/api"
"github.com/prometheus/prometheus/web/blob" "github.com/prometheus/prometheus/web/blob"
@ -35,19 +36,19 @@ var (
func StartServing(appState *appstate.ApplicationState) { func StartServing(appState *appstate.ApplicationState) {
gorest.RegisterService(api.NewMetricsService(appState)) gorest.RegisterService(api.NewMetricsService(appState))
http.Handle("/", &StatusHandler{appState: appState}) exp.Handle("/", &StatusHandler{appState: appState})
http.HandleFunc("/graph", graphHandler) exp.HandleFunc("/graph", graphHandler)
http.HandleFunc("/console", consoleHandler) exp.HandleFunc("/console", consoleHandler)
http.Handle("/api/", gorest.Handle()) exp.Handle("/api/", gorest.Handle())
http.Handle("/metrics.json", registry.DefaultRegistry.Handler()) exp.Handle("/metrics.json", registry.DefaultHandler)
if *useLocalAssets { if *useLocalAssets {
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static")))) exp.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static"))))
} else { } else {
http.Handle("/static/", http.StripPrefix("/static/", new(blob.Handler))) exp.Handle("/static/", http.StripPrefix("/static/", new(blob.Handler)))
} }
go http.ListenAndServe(*listenAddress, nil) go http.ListenAndServe(*listenAddress, exp.DefaultCoarseMux)
} }
func getTemplate(name string) (t *template.Template, err error) { func getTemplate(name string) (t *template.Template, err error) {