From 03a2107d8d1187814a225602749d497a4d4e8bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= <93934272+Stefan-Ethernal@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:55:50 +0200 Subject: [PATCH] Add version metadata to the logs (#191) * Add version metadata to the logs * Lint fix --- scripts/cluster | 2 +- server/server.go | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/scripts/cluster b/scripts/cluster index 27eacef977..76ba81f904 100755 --- a/scripts/cluster +++ b/scripts/cluster @@ -169,7 +169,7 @@ rm -rf test-chain-* rm -f genesis.json # Build binary -go build -o blade . +make build # If --docker flag is set run docker environment otherwise run from binary case "$2" in diff --git a/server/server.go b/server/server.go index c95522efd4..f6862a2f3b 100644 --- a/server/server.go +++ b/server/server.go @@ -12,19 +12,23 @@ import ( "path/filepath" "time" - "github.com/0xPolygon/polygon-edge/blockchain/storagev2" - "github.com/0xPolygon/polygon-edge/blockchain/storagev2/leveldb" - "github.com/0xPolygon/polygon-edge/blockchain/storagev2/memory" - consensusPolyBFT "github.com/0xPolygon/polygon-edge/consensus/polybft" - "github.com/0xPolygon/polygon-edge/forkmanager" - "github.com/0xPolygon/polygon-edge/gasprice" + "github.com/hashicorp/go-hclog" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "google.golang.org/grpc" "github.com/0xPolygon/polygon-edge/archive" "github.com/0xPolygon/polygon-edge/blockchain" + "github.com/0xPolygon/polygon-edge/blockchain/storagev2" + "github.com/0xPolygon/polygon-edge/blockchain/storagev2/leveldb" + "github.com/0xPolygon/polygon-edge/blockchain/storagev2/memory" "github.com/0xPolygon/polygon-edge/chain" "github.com/0xPolygon/polygon-edge/consensus" + consensusPolyBFT "github.com/0xPolygon/polygon-edge/consensus/polybft" "github.com/0xPolygon/polygon-edge/contracts" "github.com/0xPolygon/polygon-edge/crypto" + "github.com/0xPolygon/polygon-edge/forkmanager" + "github.com/0xPolygon/polygon-edge/gasprice" "github.com/0xPolygon/polygon-edge/helper/common" "github.com/0xPolygon/polygon-edge/helper/progress" "github.com/0xPolygon/polygon-edge/jsonrpc" @@ -39,10 +43,7 @@ import ( "github.com/0xPolygon/polygon-edge/txpool" "github.com/0xPolygon/polygon-edge/types" "github.com/0xPolygon/polygon-edge/validate" - "github.com/hashicorp/go-hclog" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" - "google.golang.org/grpc" + "github.com/0xPolygon/polygon-edge/versioning" ) var ( @@ -147,6 +148,11 @@ func NewServer(config *Config) (*Server, error) { } m.logger.Info("Data dir", "path", config.DataDir) + m.logger.Info("Version metadata", + "version", versioning.Version, + "commit", versioning.Commit, + "branch", versioning.Branch, + "build time", versioning.BuildTime) var dirPaths = []string{ "blockchain",