mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-13 12:36:39 +00:00
Add version to fluffy cli flags and metrics (#1736)
Also update Grafana dashboard to incorperate the metrics and do a confutils module bump.
This commit is contained in:
parent
2b23fe2ba4
commit
c04f2477ac
@ -276,7 +276,10 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
|
|||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
{.pop.}
|
{.pop.}
|
||||||
let config = PortalConf.load()
|
let config = PortalConf.load(
|
||||||
|
version = clientName & " " & fullVersionStr & "\p\p" & nimBanner,
|
||||||
|
copyrightBanner = copyrightBanner
|
||||||
|
)
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
case config.cmd
|
case config.cmd
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,6 @@ import
|
|||||||
beacon_chain/spec/forks,
|
beacon_chain/spec/forks,
|
||||||
beacon_chain/spec/datatypes/altair,
|
beacon_chain/spec/datatypes/altair,
|
||||||
beacon_chain/beacon_clock,
|
beacon_chain/beacon_clock,
|
||||||
beacon_chain/nimbus_binary_common,
|
|
||||||
beacon_chain/conf
|
beacon_chain/conf
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import strutils
|
import
|
||||||
|
std/strutils,
|
||||||
|
metrics
|
||||||
|
|
||||||
const
|
const
|
||||||
versionMajor* = 0
|
versionMajor* = 0
|
||||||
@ -23,10 +25,37 @@ const
|
|||||||
|
|
||||||
clientName* = "fluffy"
|
clientName* = "fluffy"
|
||||||
|
|
||||||
nimVersion* = staticExec("nim --version | grep -oP '[0-9]+\\.[0-9]+\\.[0-9]+'")
|
nimFullBanner = staticExec("nim --version")
|
||||||
|
nimBanner* = staticExec("nim --version | grep Version")
|
||||||
|
|
||||||
# The web3_clientVersion
|
# The web3_clientVersion
|
||||||
clientVersion* = clientName & "/" &
|
clientVersion* = clientName & "/" &
|
||||||
fullVersionStr & "/" &
|
fullVersionStr & "/" &
|
||||||
hostOS & "-" & hostCPU & "/" &
|
hostOS & "-" & hostCPU & "/" &
|
||||||
"Nim" & nimVersion
|
"Nim" & NimVersion
|
||||||
|
|
||||||
|
compileYear = CompileDate[0 ..< 4] # YYYY-MM-DD (UTC)
|
||||||
|
copyrightBanner* =
|
||||||
|
"Copyright (c) 2021-" & compileYear & " Status Research & Development GmbH"
|
||||||
|
|
||||||
|
func getNimGitHash*(): string =
|
||||||
|
const gitPrefix = "git hash: "
|
||||||
|
let tmp = splitLines(nimFullBanner)
|
||||||
|
if tmp.len == 0:
|
||||||
|
return
|
||||||
|
for line in tmp:
|
||||||
|
if line.startsWith(gitPrefix) and line.len > 8 + gitPrefix.len:
|
||||||
|
result = line[gitPrefix.len..<gitPrefix.len + 8]
|
||||||
|
|
||||||
|
# TODO: Currently prefixing these metric names as the non prefixed names give
|
||||||
|
# a collector already registered conflict at runtime. This is due to the same
|
||||||
|
# names in nimbus-eth2 nimbus_binary_common.nim even though there are no direct
|
||||||
|
# imports of that file.
|
||||||
|
|
||||||
|
declareGauge versionGauge,"Fluffy version info (as metric labels)",
|
||||||
|
["version", "commit"], name = "fluffy_version"
|
||||||
|
versionGauge.set(1, labelValues = [fullVersionStr, gitRevision])
|
||||||
|
|
||||||
|
declareGauge nimVersionGauge, "Nim version info",
|
||||||
|
["version", "nim_commit"], name = "fluffy_nim_version"
|
||||||
|
nimVersionGauge.set(1, labelValues = [NimVersion, getNimGitHash()])
|
||||||
|
2
vendor/nim-confutils
vendored
2
vendor/nim-confutils
vendored
@ -1 +1 @@
|
|||||||
Subproject commit dbe8d61f7fbb1cb9d74b38f9012406c8071aa9e9
|
Subproject commit 674c9e4c8e0cad2b7193cc9a59c12d39a397750f
|
Loading…
x
Reference in New Issue
Block a user