chore: publish nwaku version to metric (#1234)

This commit is contained in:
Hanno Cornelius 2022-10-06 13:06:54 +01:00 committed by GitHub
parent e07f422854
commit 8a184e208c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -8,9 +8,6 @@ import
logScope:
topics = "debug api"
const
git_version {.strdefine.} = "n/a"
proc installDebugApiHandlers*(node: WakuNode, rpcsrv: RpcServer) =
## Debug API version 1 definitions

View File

@ -39,6 +39,7 @@ export
when defined(rln) or defined(rlnzerokit):
import ../protocol/waku_rln_relay/waku_rln_relay_utils
declarePublicGauge waku_version, "Waku version info (in git describe format)", ["version"]
declarePublicCounter waku_node_messages, "number of messages received", ["type"]
declarePublicGauge waku_node_filters, "number of content filter subscriptions"
declarePublicGauge waku_node_errors, "number of wakunode errors", ["type"]
@ -46,6 +47,9 @@ declarePublicGauge waku_node_errors, "number of wakunode errors", ["type"]
logScope:
topics = "wakunode"
# Git version in git describe format (defined compile time)
const git_version* {.strdefine.} = "n/a"
# Default clientId
const clientId* = "Nimbus Waku v2 node"
@ -759,6 +763,8 @@ proc start*(node: WakuNode) {.async.} =
##
## Status: Implemented.
waku_version.set(1, labelValues=[git_version])
## NB: careful when moving this. We need to start the switch with the bind address
## BEFORE updating with announced addresses for the sake of identify.
await node.switch.start()
@ -1185,7 +1191,6 @@ when isMainModule:
# if called with --version, print the version and quit
if conf.version:
const git_version {.strdefine.} = "n/a"
echo "version / git commit hash: ", git_version
quit(QuitSuccess)