code: func (engine *DockerStatsEngine) taskContainerMetricsUnsafe(taskArn string) ([]*ecstcs.ContainerMetric, error) {
  	containerMap, taskExists := engine.tasksToContainers[taskArn]
  	if !taskExists {
  		return nil, fmt.Errorf("Task not found")
  	}
  
  	var containerMetrics []*ecstcs.ContainerMetric
  	for _, container := range containerMap {
  		dockerID := container.containerMetadata.DockerID
  		// Check if the container is terminal. If it is, make sure that it is
  		// cleaned up properly. We might sometimes miss events from docker task
  		// engine and this helps in reconciling the state. The tcs client's
  		// GetInstanceMetrics probe is used as the trigger for this.
  		if engine.stopTrackingContainerUnsafe(container, taskArn) {
  			continue
  		}
  
  		if !container.statsQueue.enoughDatapointsInBuffer() &&
  			!container.statsQueue.resetThresholdElapsed(queueResetThreshold) {
  			seelog.Debugf("Stats not ready for container %s", dockerID)
  			continue
  		}
  
  		// Container is not terminal. Get CPU stats set.
  		cpuStatsSet, err := container.statsQueue.GetCPUStatsSet()
  		if err != nil {
  			seelog.Warnf("Error getting cpu stats, err: %v, container: %v", err, dockerID)
  			continue
  		}
  
  		// Get memory stats set.
  		memoryStatsSet, err := container.statsQueue.GetMemoryStatsSet()
  		if err != nil {
  			seelog.Warnf("Error getting memory stats, err: %v, container: %v", err, dockerID)
  			continue
  		}
  
  		containerMetrics = append(containerMetrics, &ecstcs.ContainerMetric{
  			CpuStatsSet:    cpuStatsSet,
  			MemoryStatsSet: memoryStatsSet,
  		})
  
  	}
  
  	return containerMetrics, nil
  }
docs: // taskContainerMetricsUnsafe gets all container metrics for a task arn.