From 5afca289d795b3bbd462bde4eb8b77a69be93080 Mon Sep 17 00:00:00 2001 From: isobelormiston Date: Thu, 27 Jul 2023 10:45:24 +0100 Subject: [PATCH] Add instance_name label to currentBuilds metric (#252) * Add instance_name label to currentBuilds metric * Rename * Bump version --- ChangeLog | 4 ++++ VERSION | 2 +- mettle/worker/worker.go | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30b1c8b4..3100aeb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 11.0.7 +-------------- + * adding label to currentBuilds metric + Version 11.0.6 -------------- * correcting env keys for worker and api servers diff --git a/VERSION b/VERSION index 5326b8b7..d65b4d44 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.0.6 +11.0.7 \ No newline at end of file diff --git a/mettle/worker/worker.go b/mettle/worker/worker.go index 27076f9b..414cdca1 100644 --- a/mettle/worker/worker.go +++ b/mettle/worker/worker.go @@ -57,10 +57,10 @@ var totalBuilds = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: "mettle", Name: "builds_total", }) -var currentBuilds = prometheus.NewGauge(prometheus.GaugeOpts{ +var currentBuilds = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "mettle", Name: "builds_current", -}) +}, []string{"instance"}) var executeDurations = prometheus.NewHistogram(prometheus.HistogramOpts{ Namespace: "mettle", Name: "build_durations_secs", @@ -471,8 +471,8 @@ func (w *worker) runTask(msg *pubsub.Message) *pb.ExecuteResponse { go w.extendAckDeadline(ctx, msg) } totalBuilds.Inc() - currentBuilds.Inc() - defer currentBuilds.Dec() + currentBuilds.WithLabelValues(w.instanceName).Inc() + defer currentBuilds.WithLabelValues(w.instanceName).Dec() w.metadata = &pb.ExecutedActionMetadata{ Worker: w.name, WorkerStartTimestamp: ptypes.TimestampNow(),