Skip to content

Commit

Permalink
Add instance_name label to currentBuilds metric
Browse files Browse the repository at this point in the history
  • Loading branch information
isobelormiston committed Jul 26, 2023
1 parent 0bed043 commit 2d12748
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mettle/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{"namespace"})
var executeDurations = prometheus.NewHistogram(prometheus.HistogramOpts{
Namespace: "mettle",
Name: "build_durations_secs",
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 2d12748

Please sign in to comment.