diff --git a/config/version.go b/config/version.go index b57e82289a..5a1b31ce0e 100644 --- a/config/version.go +++ b/config/version.go @@ -18,7 +18,6 @@ package config import ( "fmt" - "runtime" "strconv" ) @@ -136,11 +135,6 @@ func GetAlgorandVersion() string { return currentVersion.String() } -// GetAlgorandVersionAndBuild retrieves the current version and build -func GetAlgorandVersionAndBuild() string { - return fmt.Sprintf("algod/%d.%d.%d (%s; commit=%s) %s(%s)", currentVersion.Major, currentVersion.Minor, currentVersion.BuildNumber, currentVersion.Channel, currentVersion.CommitHash, runtime.GOOS, runtime.GOARCH) -} - // GetLicenseInfo retrieves the current license information func GetLicenseInfo() string { return "go-algorand is licensed with AGPLv3.0\nsource code available at https://github.com/algorand/go-algorand" diff --git a/daemon/algod/server.go b/daemon/algod/server.go index 1d58a66468..67aaaeb4f2 100644 --- a/daemon/algod/server.go +++ b/daemon/algod/server.go @@ -28,6 +28,7 @@ import ( "os" "os/signal" "path/filepath" + "runtime" "strings" "syscall" "time" @@ -230,8 +231,15 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes NodeExporterPath: cfg.NodeExporterPath, }) - var algodEnvironmentAlgodVersionCounter = metrics.MakeCounter(metrics.MetricName{Name: "algod_environment_algod_version", Description: "Version of the Algod binary"}) - algodEnvironmentAlgodVersionCounter.Inc(map[string]string{"version": config.GetAlgorandVersionAndBuild()}) + var currentVersion = config.GetCurrentVersion() + var algodEnvironmentAlgodVersionGauge = metrics.MakeGauge(metrics.MetricName{Name: "algod_environment_algod_version", Description: "Version of the Algod binary"}) + algodEnvironmentAlgodVersionGauge.SetLabels(1, map[string]string{ + "version": fmt.Sprintf("%d.%d.%d", currentVersion.Major, currentVersion.Minor, currentVersion.BuildNumber), + "goarch": runtime.GOARCH, + "goos": runtime.GOOS, + "commit": currentVersion.CommitHash, + "channel": currentVersion.Channel, + }) var serverNode ServerNode if cfg.EnableFollowMode {