func (self *manager) GetContainerInfoV2(containerName string, options v2.RequestOptions) (map[string]v2.ContainerInfo, error) { containers, err := self.getRequestedContainers(containerName, options) if err != nil { return nil, err } infos := make(map[string]v2.ContainerInfo, len(containers)) for name, container := range containers { cinfo, err := container.GetInfo() if err != nil { return nil, err } var nilTime time.Time // Ignored. stats, err := self.memoryCache.RecentStats(name, nilTime, nilTime, options.Count) if err != nil { return nil, err } infos[name] = v2.ContainerInfo{ Spec: self.getV2Spec(cinfo), Stats: v2.ContainerStatsFromV1(&cinfo.Spec, stats), } } return infos, nil }
func (self *manager) GetContainerInfoV2(containerName string, options v2.RequestOptions) (map[string]v2.ContainerInfo, error) { containers, err := self.getRequestedContainers(containerName, options) if err != nil { return nil, err } var errs partialFailure var nilTime time.Time // Ignored. infos := make(map[string]v2.ContainerInfo, len(containers)) for name, container := range containers { result := v2.ContainerInfo{} cinfo, err := container.GetInfo() if err != nil { errs.append(name, "GetInfo", err) infos[name] = result continue } result.Spec = self.getV2Spec(cinfo) stats, err := self.memoryCache.RecentStats(name, nilTime, nilTime, options.Count) if err != nil { errs.append(name, "RecentStats", err) infos[name] = result continue } result.Stats = v2.ContainerStatsFromV1(&cinfo.Spec, stats) infos[name] = result } return infos, errs.OrNil() }