add nim commit to the gauge (#4155)
This commit is contained in:
parent
154723947b
commit
fcc46d3e3d
|
@ -116,8 +116,8 @@ declareGauge next_action_wait,
|
|||
declareGauge versionGauge, "Nimbus version info (as metric labels)", ["version", "commit"], name = "version"
|
||||
versionGauge.set(1, labelValues=[fullVersionStr, gitRevision])
|
||||
|
||||
declareGauge nimVersionGauge, "Nim version info", ["nim_version"], name = "Nim_version"
|
||||
nimVersionGauge.set(1, labelValues=[NimVersion])
|
||||
declareGauge nimVersionGauge, "Nim version info", ["version", "nim_commit"], name = "nim_version"
|
||||
nimVersionGauge.set(1, labelValues=[NimVersion, getNimGitHash()])
|
||||
|
||||
logScope: topics = "beacnde"
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ const
|
|||
|
||||
gitRevision* = strip(staticExec("git rev-parse --short HEAD"))[0..5]
|
||||
|
||||
nimFullBanner* = staticExec("nim --version")
|
||||
nimBanner* = staticExec("nim --version | grep Version")
|
||||
|
||||
versionAsStr* =
|
||||
|
@ -31,16 +32,18 @@ const
|
|||
|
||||
fullVersionStr* = "v" & versionAsStr & "-" & gitRevision & "-" & versionBlob
|
||||
|
||||
func shortNimBanner*(): string =
|
||||
func getNimGitHash*(): string =
|
||||
const gitPrefix = "git hash: "
|
||||
let tmp = splitLines(nimBanner)
|
||||
let tmp = splitLines(nimFullBanner)
|
||||
if tmp.len == 0:
|
||||
return
|
||||
var gitHash = ""
|
||||
for line in tmp:
|
||||
if line.startsWith(gitPrefix) and line.len > 8 + gitPrefix.len:
|
||||
gitHash = line[gitPrefix.len..<gitPrefix.len + 8]
|
||||
result = line[gitPrefix.len..<gitPrefix.len + 8]
|
||||
|
||||
func shortNimBanner*(): string =
|
||||
let gitHash = getNimGitHash()
|
||||
let tmp = splitLines(nimFullBanner)
|
||||
if gitHash.len > 0:
|
||||
tmp[0] & " (" & gitHash & ")"
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue