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:
Kim De Mey 2023-09-07 16:27:13 +02:00 committed by GitHub
parent 2b23fe2ba4
commit c04f2477ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 611 additions and 366 deletions

View File

@ -276,7 +276,10 @@ proc run(config: PortalConf) {.raises: [CatchableError].} =
when isMainModule:
{.pop.}
let config = PortalConf.load()
let config = PortalConf.load(
version = clientName & " " & fullVersionStr & "\p\p" & nimBanner,
copyrightBanner = copyrightBanner
)
{.push raises: [].}
case config.cmd

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@ import
beacon_chain/spec/forks,
beacon_chain/spec/datatypes/altair,
beacon_chain/beacon_clock,
beacon_chain/nimbus_binary_common,
beacon_chain/conf
type

View File

@ -7,7 +7,9 @@
{.push raises: [].}
import strutils
import
std/strutils,
metrics
const
versionMajor* = 0
@ -23,10 +25,37 @@ const
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
clientVersion* = clientName & "/" &
fullVersionStr & "/" &
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()])

@ -1 +1 @@
Subproject commit dbe8d61f7fbb1cb9d74b38f9012406c8071aa9e9
Subproject commit 674c9e4c8e0cad2b7193cc9a59c12d39a397750f