From 507cac083d3ee4eb28f32e1e39d4f34ca8b12c07 Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Mon, 6 Nov 2023 13:35:15 +0100 Subject: [PATCH] add vocdoni_info metric with version, mode and chainID --- cmd/node/main.go | 4 ++++ cmd/voconed/voconed.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/cmd/node/main.go b/cmd/node/main.go index 254e9835b..07381946d 100644 --- a/cmd/node/main.go +++ b/cmd/node/main.go @@ -16,6 +16,7 @@ import ( "syscall" "time" + "github.com/VictoriaMetrics/metrics" "github.com/google/uuid" flag "github.com/spf13/pflag" "github.com/spf13/viper" @@ -515,6 +516,9 @@ func main() { // This flag will make CometBFT register their metrics in prometheus srv.Config.TendermintMetrics = true srv.Router.ExposePrometheusEndpoint("/metrics") + + metrics.NewCounter(fmt.Sprintf("vocdoni_info{version=%q,mode=%q,chain=%q}", + internal.Version, conf.Mode, conf.Vochain.Chain)).Set(1) } } diff --git a/cmd/voconed/voconed.go b/cmd/voconed/voconed.go index f1afef020..f2d387cea 100644 --- a/cmd/voconed/voconed.go +++ b/cmd/voconed/voconed.go @@ -11,6 +11,7 @@ import ( "syscall" "time" + "github.com/VictoriaMetrics/metrics" "github.com/ethereum/go-ethereum/common" flag "github.com/spf13/pflag" "github.com/spf13/viper" @@ -232,6 +233,8 @@ func main() { } vc.Router.ExposePrometheusEndpoint("/metrics") + metrics.NewCounter(fmt.Sprintf("vocdoni_info{version=%q,mode=%q,chain=%q}", + internal.Version, "vocone", config.chainID)).Set(1) // enable faucet if requested, this will create a new account and attach the faucet API to the vocone API if config.enableFaucetWithAmount > 0 {