From 3468c9b873388de4e9c3656e2952302d0f719736 Mon Sep 17 00:00:00 2001 From: isobelormiston Date: Tue, 22 Aug 2023 17:23:06 +0100 Subject: [PATCH] Initialise vector metrics (#258) --- ChangeLog | 4 ++++ VERSION | 2 +- mettle/worker/worker.go | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0114894a..2eae7ba4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 11.2.2 +-------------- + * Correctly initialise Prometheus Vector metrics + Version 11.2.1 -------------- * Temporarily increase Elan ctx timeout diff --git a/VERSION b/VERSION index 6a60423c..e4bec135 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.2.1 \ No newline at end of file +11.2.2 \ No newline at end of file diff --git a/mettle/worker/worker.go b/mettle/worker/worker.go index 6e36f598..740e1220 100644 --- a/mettle/worker/worker.go +++ b/mettle/worker/worker.go @@ -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 }