// generate the anomaly counts for all services
// func GenerateSummaryReport(serviceslist []string, currentYear *int, currentMonth *time.Month, currentDay *int) {
generate the anomaly counts for all services
func GenerateSummaryReport(serviceslist []string, currentYear *int, currentMonth *time.Month, currentDay *int) {
// generate the anomaly counts for all services // func GenerateSummaryReport ( serviceslist [] string currentYear * int currentMonth * time . Month currentDay * int ) {
func GenerateSummaryReport(serviceslist map[string]JobInfoM, currentYear *int, currentMonth *time.Month, currentDay *int) {
	var reports []string
	filename := os.Getenv("VOLUME_PATH") + "/anomalyreport" + strconv.Itoa(*currentYear) + "-" + (*currentMonth).String() + "-" + strconv.Itoa(*currentDay) + ".txt"
	reportfile, err := os.OpenFile(filename, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0777)
	if err != nil {
		log.Printf("error creating file for anomaly report: %s\n%s\n", err, err.Error())
		log.Printf("Failed to generate report")
		return
	}
	defer reportfile.Close()
	header := "Timestamp\t"
	for _, info := range serviceslist {
		for metric, _ := range info.MetricMap {
			header = header + metric + "\t"
		}
		break
	}
	header = header + "\n"
	reportfile.WriteString(header)
	for name, info := range serviceslist {
		reports = append(reports, GenerateReport(name, info, currentYear, currentMonth, currentDay))
	}
	for _, report := range reports {
		reportfile.WriteString(report)
	}
	log.Printf("Generated report")
}
func GenerateSummaryReport ( serviceslist map [ string ] JobInfoM , currentYear * int , currentMonth * time . Month , currentDay * int ) { var reports [ ] string filename := os . Getenv ( " " ) + " " + strconv . Itoa ( * currentYear ) + " " + ( * currentMonth ) . String ( ) + " " + strconv . Itoa ( * currentDay ) + " " reportfile , err := os . OpenFile ( filename , os . O_CREATE | os . O_TRUNC | os . O_WRONLY , 0777 ) if err != nil { log . Printf ( " \n \n " , err , err . Error ( ) ) log . Printf ( " " ) return } defer reportfile . Close ( ) header := " \t " for _ , info := range serviceslist { for metric , _ := range info . MetricMap { header = header + metric + " \t " } break } header = header + " \n " reportfile . WriteString ( header ) for name , info := range serviceslist { reports = append ( reports , GenerateReport ( name , info , currentYear , currentMonth , currentDay ) ) } for _ , report := range reports { reportfile . WriteString ( report ) } log . Printf ( " " ) }
generate the anomaly counts for all services
func GenerateSummaryReport(serviceslist []string, currentYear *int, currentMonth *time.Month, currentDay *int) {
generate the anomaly counts for all services func GenerateSummaryReport ( serviceslist [] string currentYear * int currentMonth * time . Month currentDay * int ) {
// create header for spread sheet // currently assumes same metrics being monitored for all services in requests file // generate each of the lines