func dockerStatsToContainerStats(dockerStats *types.StatsJSON) (*ContainerStats, error) {
	// The length of PercpuUsage represents the number of cores in an instance.
	if len(dockerStats.CPUStats.CPUUsage.PercpuUsage) == 0 || numCores == uint64(0) {
		seelog.Debug("Invalid container statistics reported, no cpu core usage reported")
		return nil, fmt.Errorf("Invalid container statistics reported, no cpu core usage reported")
	}

	cpuUsage := dockerStats.CPUStats.CPUUsage.TotalUsage / numCores
	memoryUsage := dockerStats.MemoryStats.Usage - dockerStats.MemoryStats.Stats["cache"]
	return &ContainerStats{
		cpuUsage:    cpuUsage,
		memoryUsage: memoryUsage,
		timestamp:   dockerStats.Read,
	}, nil
}
func dockerStatsToContainerStats(dockerStats *types.StatsJSON) (*ContainerStats, error) {
	// The length of PercpuUsage represents the number of cores in an instance.
	if len(dockerStats.CPUStats.CPUUsage.PercpuUsage) == 0 || numCores == uint64(0) {
		seelog.Debug("Invalid container statistics reported, no cpu core usage reported")
		return nil, fmt.Errorf("Invalid container statistics reported, no cpu core usage reported")
	}

	cpuUsage := dockerStats.CPUStats.CPUUsage.TotalUsage / numCores
	memoryUsage := dockerStats.MemoryStats.Usage - dockerStats.MemoryStats.Stats["cache"]
	return &ContainerStats{
		cpuUsage:    cpuUsage,
		memoryUsage: memoryUsage,
		timestamp:   dockerStats.Read,
	}, nil
}
// dockerStatsToContainerStats returns a new object of the ContainerStats object from docker stats.