diff --git a/client/app/pages/admin/status/index.js b/client/app/pages/admin/status/index.js index bafe413a41..1cc092ffc6 100644 --- a/client/app/pages/admin/status/index.js +++ b/client/app/pages/admin/status/index.js @@ -10,6 +10,8 @@ function AdminStatusCtrl($scope, $http, $timeout, currentUser, Events) { delete data.workers; $scope.manager = data.manager; delete data.manager; + $scope.database_metrics = data.database_metrics; + delete data.database_metrics; $scope.status = data; }); diff --git a/client/app/pages/admin/status/status.html b/client/app/pages/admin/status/status.html index 1bcdb92053..3469d979d8 100644 --- a/client/app/pages/admin/status/status.html +++ b/client/app/pages/admin/status/status.html @@ -44,5 +44,15 @@ +
+
+ +
diff --git a/redash/monitor.py b/redash/monitor.py index 08b3ec9a17..365950ed6a 100644 --- a/redash/monitor.py +++ b/redash/monitor.py @@ -31,4 +31,14 @@ def get_status(): 'size': redis_connection.llen(queue) } + status['database_metrics'] = [] + # have to include the fake FROM in the SQL to prevent an IndexError + queries = [ + ['Query Results Size', "pg_size_pretty(pg_total_relation_size('query_results')) as size from (select 1) as a"], + ['Redash DB Size', "pg_size_pretty(pg_database_size('postgres')) as size from (select 1) as a"] + ] + for query_name, query in queries: + result = models.db.session.query(query).first() + status['database_metrics'].append([query_name, result[0]]) + return status