type Provider … type handler … // CreateHandlers creates the REST handlers for the stats. func CreateHandlers(rootPath string, provider Provider, summaryProvider SummaryProvider) *restful.WebService { … } // Handles stats summary requests to /stats/summary // If "only_cpu_and_memory" GET param is true then only cpu and memory is returned in response. func (h *handler) handleSummary(request *restful.Request, response *restful.Response) { … } func writeResponse(response *restful.Response, stats interface{ … } // handleError serializes an error object into an HTTP response. // request is provided for logging. func handleError(response *restful.Response, request string, err error) { … }