include version and build info in prometheus output

This commit is contained in:
Alex Grintsvayg 2020-01-22 19:13:58 -05:00
parent bb23f509d7
commit d9f809864f
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5
3 changed files with 7 additions and 3 deletions

View file

@ -32,7 +32,7 @@ def main():
build_type = get_build_type(os.getenv('CI_COMMIT_TAG', os.getenv('TRAVIS_TAG')))
log.debug("setting build type=%s, build commit=%s", build_type, commit_hash)
with open(build_type_path, 'w') as f:
f.write(f"BUILD = \"{build_type}\"\nBUILD_COMMIT = \"{commit_hash}\"\n")
f.write(f"BUILD = \"{build_type}\"\nCOMMIT_HASH = \"{commit_hash}\"\n")
if __name__ == '__main__':

View file

@ -1,3 +1,3 @@
# don't touch this. CI server changes this during build/deployment
BUILD = "dev"
BUILD_COMMIT = "source installation"
COMMIT_HASH = "none"

View file

@ -1,9 +1,13 @@
from aiohttp import web
from prometheus_client import Counter, generate_latest as prom_generate_latest
from prometheus_client import Counter, Info, generate_latest as prom_generate_latest
from lbry.wallet.server import util
from lbry import __version__ as version
from lbry.build_type import BUILD, COMMIT_HASH
NAMESPACE = "wallet_server"
VERSION_INFO = Info('build_info', 'Wallet server build info (e.g. version, commit hash)', namespace=NAMESPACE)
VERSION_INFO.info({'version': version, 'build': BUILD, "commit": COMMIT_HASH})
REQUESTS_COUNT = Counter("requests_count", "Number of requests received", namespace=NAMESPACE)