From 4621768c149c050f32126f3e811c9e61dbcb1aee Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Tue, 15 Mar 2022 20:07:32 +0000 Subject: [PATCH] server/requestJob: record metrics last This ensures that only if the dequeuing is successful are metrics recorded. --- internal/worker/server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/worker/server.go b/internal/worker/server.go index 9405d06b9..56c5fa0f6 100644 --- a/internal/worker/server.go +++ b/internal/worker/server.go @@ -453,8 +453,6 @@ func (s *Server) requestJob(ctx context.Context, arch string, jobTypes []string, if err != nil { logrus.Errorf("error retrieving job status: %v", err) return - } else { - prometheus.DequeueJobMetrics(status.Queued, status.Started, jobType) } for _, depID := range depIDs { @@ -474,6 +472,9 @@ func (s *Server) requestJob(ctx context.Context, arch string, jobTypes []string, } } + // TODO: Drop the ':$architecture' for metrics too, first prometheus queries for alerts and + // dashboards need to be adjusted. + prometheus.DequeueJobMetrics(status.Queued, status.Started, jobType) if jobType == "osbuild:"+arch { jobType = "osbuild" } else if jobType == "osbuild-koji:"+arch {