Documentation ¶
Overview ¶
Package miniprofiler_gae is a simple but effective mini-profiler for app engine.
miniprofiler_gae hooks into the appstats package, and all app engine RPCs are automatically profiled. An appstats link is listed in each Profile.
To use this package, change your HTTP handler functions to use this signature:
func(mpg.Context, http.ResponseWriter, *http.Request)
Register them in the usual way, wrapping them with NewHandler.
Send output of c.Includes() to your HTML (it is empty if Enable returns false).
By default, miniprofiler_gae is enabled on dev for all and on prod for admins. Override miniprofiler.Enable to change.
Step ¶
Unlike base miniprofiler, the Step function returns a profiled context:
c.Step("something", func(c mpg.Context) { // c is valid appengine.Context and miniprofiler.Timer: // datastore.Get(c, key, entity) // c.Step("another", func(c mpg.Context) { ... }) })
See the miniprofiler package docs about further usage: http://godoc.org/github.com/MiniProfiler/go/miniprofiler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableIfAdminOrDev ¶
EnableIfAdminOrDev returns true if this is the dev server or the current user is an admin. This is the default for miniprofiler.Enable.
func GetMemcache ¶
func GetMemcache(r *http.Request, id string) *miniprofiler.Profile
GetMemcache gets the Profile from memcache. This is the default for miniprofiler.Get.
func Instance ¶
func Instance() string
Instance returns the app engine instance id, or the hostname on dev. This is the default for miniprofiler.MachineName.
func NewHandler ¶
NewHandler returns a profiled, appstats-aware appengine.Context.
func StoreMemcache ¶
func StoreMemcache(r *http.Request, p *miniprofiler.Profile)
StoreMemcache stores the Profile in memcache. This is the default for miniprofiler.Store.
Types ¶
type Context ¶
type Context struct { appstats.Context miniprofiler.Timer }
func (Context) Call ¶
func (c Context) Call(service, method string, in, out appengine_internal.ProtoMessage, opts *appengine_internal.CallOptions) (err error)