diff --git a/cmd/cli/main.go b/cmd/cli/main.go index af4b7d8075..5863276d0b 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -4,8 +4,10 @@ import ( "os" "github.com/ethereum/go-ethereum/internal/cli" + "github.com/ethereum/go-ethereum/params" ) func main() { + params.UpdateBorInfo() os.Exit(cli.Run(os.Args[1:])) } diff --git a/params/version.go b/params/version.go index 43c57b5365..0fa58e33fd 100644 --- a/params/version.go +++ b/params/version.go @@ -18,6 +18,8 @@ package params import ( "fmt" + + "github.com/ethereum/go-ethereum/metrics" ) const ( @@ -27,7 +29,18 @@ const ( VersionMeta = "" // Version metadata to append to the version string ) -var GitCommit string +var ( + borInfo = metrics.NewRegisteredGaugeInfo("bor/info", nil) + GitCommit string +) + +// UpdateBorInfo updates the bor_info with the current git commit and version details. +func UpdateBorInfo() { + borInfo.Update(metrics.GaugeInfoValue{ + "commit": GitCommit, + "version": VersionWithMeta, + }) +} // Version holds the textual version string. var Version = func() string {