mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
parent
3ed0ff85f5
commit
6a55169e2e
1 changed files with 17 additions and 0 deletions
17
api.go
17
api.go
|
@ -6,6 +6,7 @@ import (
|
||||||
"code.google.com/p/go.net/websocket"
|
"code.google.com/p/go.net/websocket"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"expvar"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dotcloud/docker/archive"
|
"github.com/dotcloud/docker/archive"
|
||||||
"github.com/dotcloud/docker/auth"
|
"github.com/dotcloud/docker/auth"
|
||||||
|
@ -1063,7 +1064,23 @@ func makeHttpHandler(srv *Server, logging bool, localMethod string, localRoute s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replicated from expvar.go as not public.
|
||||||
|
func expvarHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
fmt.Fprintf(w, "{\n")
|
||||||
|
first := true
|
||||||
|
expvar.Do(func(kv expvar.KeyValue) {
|
||||||
|
if !first {
|
||||||
|
fmt.Fprintf(w, ",\n")
|
||||||
|
}
|
||||||
|
first = false
|
||||||
|
fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
|
||||||
|
})
|
||||||
|
fmt.Fprintf(w, "\n}\n")
|
||||||
|
}
|
||||||
|
|
||||||
func AttachProfiler(router *mux.Router) {
|
func AttachProfiler(router *mux.Router) {
|
||||||
|
router.HandleFunc("/debug/vars", expvarHandler)
|
||||||
router.HandleFunc("/debug/pprof/", pprof.Index)
|
router.HandleFunc("/debug/pprof/", pprof.Index)
|
||||||
router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||||
router.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
router.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue