func setupAPIStats(app *server.App) { var API = app.API() // -------------------------------------------------------------------------- // Stats API.GET("/stats/", server.Handler(func(req *wcg.Request) response.Response { stats, _ := runtime.Stats(gae.NewContext(req)) json := map[string]interface{}{ "version": lib.Commit, "timestamp": lib.Timestamp, "stats": stats, "environment": lib.CurrentEnvironment(), "envvars": lib.GetEnvVars(), } if _, dsStats, err := entities.DatastoreStat.Get().Key("total_entities_usage").One(req); err != nil { json["datastore"] = dsStats } // use array response for API convention. return response.NewJSONResponse( [](map[string]interface{}){ json, }, ) })) }
// DevScheduleCron is like ScheduleCron but for dev environment func (config *AsyncAPIConfig) DevScheduleCron(description string, schedules ...string) { if lib.CurrentEnvironment() == lib.EIDevGAE { config.scheduleCron(description, schedules...) } }