PrintSummary prints a consolidated summary across all jobs
()
| 47 | |
| 48 | // PrintSummary prints a consolidated summary across all jobs |
| 49 | func (da *Auditor) PrintSummary() { |
| 50 | // First print the regular report |
| 51 | da.PrintReport() |
| 52 | |
| 53 | da.mu.RLock() |
| 54 | jobs := make([]JobAnalysis, 0, len(da.jobs)) |
| 55 | for _, job := range da.jobs { |
| 56 | jobs = append(jobs, cloneJobAnalysis(job)) |
| 57 | } |
| 58 | da.mu.RUnlock() |
| 59 | |
| 60 | // Then print the consolidated summary |
| 61 | fmt.Println("\n" + strings.Repeat("═", 80)) |
| 62 | fmt.Println("CONSOLIDATED SUMMARY ACROSS ALL JOBS") |
| 63 | fmt.Println(strings.Repeat("═", 80)) |
| 64 | |
| 65 | // Collect all contexts across all jobs |
| 66 | type contextSummary struct { |
| 67 | family string |
| 68 | context string |
| 69 | title string |
| 70 | units string |
| 71 | priority int |
| 72 | chartType string |
| 73 | labelKeys []string |
| 74 | dimNames []string |
| 75 | instances int |
| 76 | jobs map[string]bool |
| 77 | } |
| 78 | |
| 79 | contextMap := make(map[string]*contextSummary) // context -> summary |
| 80 | |
| 81 | for i := range jobs { |
| 82 | job := &jobs[i] |
| 83 | jobLabel := fmt.Sprintf("%s[%s]", job.Module, job.Name) |
| 84 | for i := range job.Charts { |
| 85 | ca := &job.Charts[i] |
| 86 | |
| 87 | ctx := ca.Chart.Ctx |
| 88 | if _, exists := contextMap[ctx]; !exists { |
| 89 | // Collect unique label keys |
| 90 | labelKeysMap := make(map[string]bool) |
| 91 | for _, label := range ca.Chart.Labels { |
| 92 | labelKeysMap[label.Key] = true |
| 93 | } |
| 94 | labelKeys := []string{} |
| 95 | for key := range labelKeysMap { |
| 96 | labelKeys = append(labelKeys, key) |
| 97 | } |
| 98 | sort.Strings(labelKeys) |
| 99 | |
| 100 | // Collect unique dimension names |
| 101 | dimNamesMap := make(map[string]bool) |
| 102 | for _, dim := range ca.Chart.Dims { |
| 103 | dimName := dim.Name |
| 104 | if dimName == "" { |
| 105 | dimName = dim.ID |
| 106 | } |
no test coverage detected