Skip to content

Commit

Permalink
Merge pull request #70 from kubevirt/lane-percentages
Browse files Browse the repository at this point in the history
sig,badges: Include the percentage failure rate in SIG and lane badges
  • Loading branch information
dhiller authored Oct 2, 2024
2 parents b6ce3bb + fe5a532 commit 30f618a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (b *Handler) writeSIGRetestBadge(name, filePath string, data types.RunningA
}
defer f.Close()

badgeString := fmt.Sprintf("%.0f / %.0f", value, total)
badgeString := fmt.Sprintf("%.0f / %.0f | %.0f%s", value, total, (value/total)*100, "%")

return badge.Render(name, badgeString, color, f)
}
Expand All @@ -241,7 +241,10 @@ func (b *Handler) writeJobFailureBadges(data types.RunningAverageDataItem, level
if i < len(failedJobLeaders) {
job := failedJobLeaders[i-1]
color := BadgeColor(float64(job.FailureCount), levels)
badgeString := fmt.Sprintf("%.0f / %.0f", float64(job.FailureCount), float64(job.FailureCount+job.SuccesCount))
badgeString := fmt.Sprintf("%.0f / %.0f | %.0f%s",
float64(job.FailureCount),
float64(job.FailureCount+job.SuccessCount),
(float64(job.FailureCount)/float64(job.FailureCount+job.SuccessCount))*100, "%")

err = badge.Render(job.JobName, badgeString, color, f)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (h *Handler) sigRetestsProcessor(results *types.Results) (*types.Results, e
for i, job := range sortedFailedJobs {
for _, success := range successJobNames {
if job.JobName == success {
sortedFailedJobs[i].SuccesCount++
sortedFailedJobs[i].SuccessCount++
}
}
for _, failedJobURL := range failedJobURLs {
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ type DataPoint struct {
type FailedJob struct {
JobName string
FailureCount int
SuccesCount int
SuccessCount int
FailureURLs []string
}

Expand Down

0 comments on commit 30f618a

Please sign in to comment.