func sendStats(stats *task.TaskStatus) error { logit.Info.Println(stats.Status) stats.ContainerName = restoreContainerName stats.ScheduleID = restoreScheduleID stats.ProfileName = "pg_backrest_restore" stats.Path = restoreContainerName stats.TaskName = restoreContainerName stats.ID = StatusID var addResponse task.StatusAddResponse var err error if StatusID != "" { _, err = task.StatusUpdateClient(stats) } else { addResponse, err = task.StatusAddClient(stats) StatusID = addResponse.ID } if err != nil { logit.Error.Println("error in adding status:" + err.Error()) return err } return nil }
func sendStats(stats *task.TaskStatus) error { stats.ContainerName = backupContainerName stats.ScheduleID = scheduleID stats.ProfileName = backupProfileName stats.Path = backupPath stats.TaskName = backupHost stats.ID = StatusID fmt.Println("jeff: containername=" + stats.ContainerName) fmt.Println("jeff: scheduleid=" + stats.ScheduleID) fmt.Println("jeff: ProfileName=" + stats.ProfileName) fmt.Println("jeff: Path=" + stats.Path) fmt.Println("jeff: TaskName=" + stats.TaskName) fmt.Println("jeff: ID=" + stats.ID) var addResponse task.StatusAddResponse var err error if StatusID != "" { _, err = task.StatusUpdateClient(stats) } else { addResponse, err = task.StatusAddClient(stats) StatusID = addResponse.ID } if err != nil { fmt.Println(err.Error()) io.WriteString(file, "error in adding status:"+err.Error()+"\n") return err } //send to backup fmt.Println("elapsed time:" + stats.ElapsedTime) io.WriteString(file, "elapsed time:"+stats.ElapsedTime+"\n") fmt.Println("tasksize :" + stats.TaskSize) io.WriteString(file, "tasksize :"+stats.TaskSize+"\n") return nil }