Skip to content

Commit

Permalink
Initialise vector metrics (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
isobelormiston authored Aug 22, 2023
1 parent d31c2a2 commit 3468c9b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 11.2.2
--------------
* Correctly initialise Prometheus Vector metrics

Version 11.2.1
--------------
* Temporarily increase Elan ctx timeout
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.2.1
11.2.2
5 changes: 5 additions & 0 deletions mettle/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ func initialiseWorker(instanceName, requestQueue, responseQueue, name, storage,
for name, cost := range costs {
w.costs[name] = &bbru.MonetaryResourceUsage_Expense{Currency: cost.Denomination, Cost: cost.Amount}
}

// Vector metrics need initialising explicitly with labels. See https://github.com/prometheus/client_golang/blob/main/prometheus/examples_test.go#L51-L73
currentBuilds.WithLabelValues(w.instanceName).Add(0)
blobNotFoundErrors.WithLabelValues(w.version).Add(0)

log.Notice("%s initialised with settings: CAS: %s cache dir: %s max cache size: %d sandbox: %s alt sandbox: %s", name, storage, cacheDir, maxCacheSize, w.sandbox, w.altSandbox)
return w, nil
}
Expand Down

0 comments on commit 3468c9b

Please sign in to comment.