import lbry.wallet.server.version as wallet_server_version NAMESPACE = "wallet_server" VERSION_INFO = Info('build', 'Wallet server build info (e.g. version, commit hash)', namespace=NAMESPACE) VERSION_INFO.info({ 'build': BUILD, "commit": COMMIT_HASH, 'version': version, "min_version": util.version_string(wallet_server_version.PROTOCOL_MIN), }) REQUESTS_COUNT = Counter("requests_count", "Number of requests received", namespace=NAMESPACE, labelnames=("method", )) class PrometheusServer: def __init__(self): self.logger = util.class_logger(__name__, self.__class__.__name__) self.runner = None async def start(self, port: int): prom_app = web.Application() prom_app.router.add_get('/metrics', self.handle_metrics_get_request)
def _protocol_version_string(self, key): version_str = self.features.get(key) ptuple = util.protocol_tuple(version_str) return util.version_string(ptuple)