# HG changeset patch # User Marcin Kuzminski # Date 2017-02-02 22:10:37 # Node ID 0d5c781fa9a40ffe20925e94960792196ea5a0d2 # Parent 6495d16a7390ed69229d400cb64e4e58d7e0687d system-info: added usage info. diff --git a/rhodecode/lib/system_info.py b/rhodecode/lib/system_info.py --- a/rhodecode/lib/system_info.py +++ b/rhodecode/lib/system_info.py @@ -609,11 +609,30 @@ def server_info(environ): return SysInfoRes(value=value) +def usage_info(): + from rhodecode.model.db import User, Repository + value = { + 'users': User.query().count(), + 'users_active': User.query().filter(User.active == True).count(), + 'repositories': Repository.query().count(), + 'repository_types': { + 'hg': Repository.query().filter( + Repository.repo_type == 'hg').count(), + 'git': Repository.query().filter( + Repository.repo_type == 'git').count(), + 'svn': Repository.query().filter( + Repository.repo_type == 'svn').count(), + }, + } + return SysInfoRes(value=value) + + def get_system_info(environ): environ = environ or {} return { 'rhodecode_app': SysInfo(rhodecode_app_info)(), 'rhodecode_config': SysInfo(rhodecode_config)(), + 'rhodecode_usage': SysInfo(usage_info)(), 'python': SysInfo(python_info)(), 'py_modules': SysInfo(py_modules)(),