Skip to content

Commit

Permalink
Add instance_name label to currentBuilds metric (#252)
Browse files Browse the repository at this point in the history
* Add instance_name label to currentBuilds metric

* Rename

* Bump version
  • Loading branch information
isobelormiston authored Jul 27, 2023
1 parent 0bed043 commit 5afca28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.0.6
11.0.7
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{"instance"})
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 5afca28

Please sign in to comment.