feat: bor_info metric

This commit is contained in:
kamuikatsurgi 2025-03-03 15:06:02 +05:30
parent 08f81df254
commit 7afea05a0d
No known key found for this signature in database
2 changed files with 16 additions and 1 deletions

View file

@ -4,8 +4,10 @@ import (
"os" "os"
"github.com/ethereum/go-ethereum/internal/cli" "github.com/ethereum/go-ethereum/internal/cli"
"github.com/ethereum/go-ethereum/params"
) )
func main() { func main() {
params.UpdateBorInfo()
os.Exit(cli.Run(os.Args[1:])) os.Exit(cli.Run(os.Args[1:]))
} }

View file

@ -18,6 +18,8 @@ package params
import ( import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/metrics"
) )
const ( const (
@ -27,7 +29,18 @@ const (
VersionMeta = "" // Version metadata to append to the version string 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. // Version holds the textual version string.
var Version = func() string { var Version = func() string {