Skip to content

Commit

Permalink
RELENG-6059 support relabel name on queued jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Jun 14, 2022
1 parent 276e130 commit 4795134
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions gh_actions_exporter/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ def relabel_job_labels(self, relabel: Relabel, labels: List[str]) -> Dict[str, s
return result

def relabel_job_names(self, relabel: Relabel, job: WorkflowJob) -> dict:
if job.status == 'queued':
return dict()
result = {
relabel.label: relabel.default
}
for label in relabel.values:
if label in job.runner_name:
result[relabel.label] = label
if job.status == 'queued':
result[relabel.label] = ""
else:
for label in relabel.values:
if label in job.runner_name:
result[relabel.label] = label
return result

def job_labels(self, webhook: WebHook, settings: Settings) -> dict:
Expand Down

0 comments on commit 4795134

Please sign in to comment.