agent/handlers/v2/task_container_stats_handler.go
func WriteTaskStatsResponse(w http.ResponseWriter,
	taskARN string,
	state dockerstate.TaskEngineState,
	statsEngine stats.Engine) {

	taskStatsResponse, err := NewTaskStatsResponse(taskARN, state, statsEngine)
	if err != nil {
		seelog.Warnf("Unable to get task stats for task '%s': %v", taskARN, err)
		errResponseJSON, _ := json.Marshal("Unable to get task stats for: " + taskARN)
		utils.WriteJSONToResponse(w, http.StatusBadRequest, errResponseJSON, utils.RequestTypeTaskStats)
		return
	}

	responseJSON, _ := json.Marshal(taskStatsResponse)
	utils.WriteJSONToResponse(w, http.StatusOK, responseJSON, utils.RequestTypeTaskStats)
}
func WriteTaskStatsResponse(w http.ResponseWriter,
	taskARN string,
	state dockerstate.TaskEngineState,
	statsEngine stats.Engine) {

	taskStatsResponse, err := NewTaskStatsResponse(taskARN, state, statsEngine)
	if err != nil {
		seelog.Warnf("Unable to get task stats for task '%s': %v", taskARN, err)
		errResponseJSON, _ := json.Marshal("Unable to get task stats for: " + taskARN)
		utils.WriteJSONToResponse(w, http.StatusBadRequest, errResponseJSON, utils.RequestTypeTaskStats)
		return
	}

	responseJSON, _ := json.Marshal(taskStatsResponse)
	utils.WriteJSONToResponse(w, http.StatusOK, responseJSON, utils.RequestTypeTaskStats)
}
func WriteTaskStatsResponse ( w http . ResponseWriter , taskARN string , state dockerstate . TaskEngineState , statsEngine stats . Engine ) { taskStatsResponse , err := NewTaskStatsResponse ( taskARN , state , statsEngine ) if err != nil { seelog . Warnf ( " " , taskARN , err ) errResponseJSON , _ := json . Marshal ( " " + taskARN ) utils . WriteJSONToResponse ( w , http . StatusBadRequest , errResponseJSON , utils . RequestTypeTaskStats ) return } responseJSON , _ := json . Marshal ( taskStatsResponse ) utils . WriteJSONToResponse ( w , http . StatusOK , responseJSON , utils . RequestTypeTaskStats ) }
// WriteTaskStatsResponse writes the task stats to response writer.
WriteTaskStatsResponse writes the task stats to response writer .