mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
Merge pull request #1471 from maticnetwork/krishang/bor-info
feat: `bor_info` metric
This commit is contained in:
commit
facb73215a
2 changed files with 18 additions and 1 deletions
|
|
@ -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:]))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ package params
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -27,7 +29,20 @@ const (
|
||||||
VersionMeta = "" // Version metadata to append to the version string
|
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.
|
// Version holds the textual version string.
|
||||||
var Version = func() string {
|
var Version = func() string {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue