From 13e360f64582688280c5699ae8c257040b4805b2 Mon Sep 17 00:00:00 2001 From: sindunuragarp Date: Tue, 14 Nov 2023 18:45:52 +0100 Subject: [PATCH] only store duration for specific statuses --- pkg/actionsmetrics/event_reader.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/actionsmetrics/event_reader.go b/pkg/actionsmetrics/event_reader.go index 1e0ed0f0cb..1f85db9ed4 100644 --- a/pkg/actionsmetrics/event_reader.go +++ b/pkg/actionsmetrics/event_reader.go @@ -193,8 +193,10 @@ func (reader *EventReader) ProcessWorkflowJobEvent(ctx context.Context, event in ).Inc() } - if runTimeSeconds != nil { - githubWorkflowJobRunDurationSeconds.With(extraLabel("job_conclusion", *e.WorkflowJob.Conclusion, labels)).Observe(*runTimeSeconds) + if *e.WorkflowJob.Conclusion != "cancelled" && *e.WorkflowJob.Conclusion != "skipped" && *e.WorkflowJob.Conclusion != "timed_out" { + if runTimeSeconds != nil { + githubWorkflowJobRunDurationSeconds.With(extraLabel("job_conclusion", *e.WorkflowJob.Conclusion, labels)).Observe(*runTimeSeconds) + } } } }