Merge pull request #1471 from maticnetwork/krishang/bor-info

feat: `bor_info` metric
This commit is contained in:
Krishang Shah 2025-03-03 17:51:45 +05:30 committed by GitHub
commit facb73215a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View file

@ -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:]))
}

View file

@ -18,6 +18,8 @@ package params
import (
"fmt"
"github.com/ethereum/go-ethereum/metrics"
)
const (
@ -27,7 +29,20 @@ const (
VersionMeta = "" // Version metadata to append to the version string
)
var GitCommit string
var (
// borInfoGauge stores Bor git commit and version details.
borInfoGauge = metrics.NewRegisteredGaugeInfo("bor/info", nil)
GitCommit string
)
// UpdateBorInfo updates the bor_info metric with the current git commit and version details.
func UpdateBorInfo() {
borInfoGauge.Update(metrics.GaugeInfoValue{
"commit": GitCommit,
"version": VersionWithMeta,
})
}
// Version holds the textual version string.
var Version = func() string {