// NewHandler returns a profiled, appstats-aware appengine.Context. func NewHandler(f func(Context, http.ResponseWriter, *http.Request)) appstats.Handler { return appstats.NewHandler(func(c appengine.Context, w http.ResponseWriter, r *http.Request) { pc := Context{ Context: c.(appstats.Context), } pc.P = miniprofiler.NewProfile(w, r, miniprofiler.FuncName(f)) f(pc, w, r) if pc.P.Root != nil { pc.P.CustomLink = pc.URL() pc.P.CustomLinkName = "appstats" pc.P.Finalize() } }) }
// NewHandler returns a profiled, appstats-aware appengine.Context. func NewHandler(f func(Context, http.ResponseWriter, *http.Request)) appstats.Handler { return appstats.NewHandler(func(c appengine.Context, w http.ResponseWriter, r *http.Request) { h := miniprofiler.NewHandler(func(p *miniprofiler.Profile, w http.ResponseWriter, r *http.Request) { pc := Context{ Context: c.(appstats.Context), Profile: p, } p.Name = miniprofiler.FuncName(f) f(pc, w, r) if pc.Profile.Root != nil { pc.Profile.CustomLink = pc.URL() pc.Profile.CustomLinkName = "appstats" } }) h.ServeHTTP(w, r) }) }