func TaskStatsHandler(state dockerstate.TaskEngineState, statsEngine stats.Engine) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		taskARN, err := getTaskARNByRequest(r, state)
		if err != nil {
			errResponseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 task stats handler: unable to get task arn from request: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, errResponseJSON, utils.RequestTypeTaskStats)
			return
		}

		seelog.Infof("V3 task stats handler: writing response for task '%s'", taskARN)

		// v3 handler shares the same task stats response format with v2 handler.
		v2.WriteTaskStatsResponse(w, taskARN, state, statsEngine)
	}
}
func TaskStatsHandler(state dockerstate.TaskEngineState, statsEngine stats.Engine) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		taskARN, err := getTaskARNByRequest(r, state)
		if err != nil {
			errResponseJSON, _ := json.Marshal(
				fmt.Sprintf("V3 task stats handler: unable to get task arn from request: %s", err.Error()))
			utils.WriteJSONToResponse(w, http.StatusBadRequest, errResponseJSON, utils.RequestTypeTaskStats)
			return
		}

		seelog.Infof("V3 task stats handler: writing response for task '%s'", taskARN)

		
		v2.WriteTaskStatsResponse(w, taskARN, state, statsEngine)
	}
}
func TaskStatsHandler ( state dockerstate . TaskEngineState , statsEngine stats . Engine ) func ( http . ResponseWriter , * http . Request ) { return func ( w http . ResponseWriter , r * http . Request ) { taskARN , err := getTaskARNByRequest ( r , state ) if err != nil { errResponseJSON , _ := json . Marshal ( fmt . Sprintf ( " " , err . Error ( ) ) ) utils . WriteJSONToResponse ( w , http . StatusBadRequest , errResponseJSON , utils . RequestTypeTaskStats ) return } seelog . Infof ( " " , taskARN ) // v3 handler shares the same task stats response format with v2 handler. v2 . WriteTaskStatsResponse ( w , taskARN , state , statsEngine ) } }
// TaskStatsHandler returns the handler method for handling task stats requests.
TaskStatsHandler returns the handler method for handling task stats requests .