Skip to content

Commit

Permalink
Merge pull request #231 from ventsislav-georgiev/use-status-when-miss…
Browse files Browse the repository at this point in the history
…ing-conclusion

feat(workflows): use status when missing conclusion
  • Loading branch information
tboerger committed Jul 13, 2023
2 parents d3cef39 + dfc0eae commit 6b98320
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/exporter/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ func (c *WorkflowCollector) Collect(ch chan<- prometheus.Metric) {
strconv.Itoa(record.GetRunAttempt()),
}

status := record.GetConclusion()
if status == "" {
status = record.GetStatus()
}

ch <- prometheus.MustNewConstMetric(
c.Status,
prometheus.GaugeValue,
conclusionToGauge(record.GetConclusion()),
statusToGauge(status),
labels...,
)

Expand Down Expand Up @@ -270,7 +275,7 @@ func (c *WorkflowCollector) pagedRepoWorkflows(ctx context.Context, owner, name
return workflows, nil
}

func conclusionToGauge(conclusion string) float64 {
func statusToGauge(conclusion string) float64 {
switch conclusion {
case "completed":
return 1.0
Expand Down

0 comments on commit 6b98320

Please sign in to comment.