diff --git a/client/app/pages/admin/status/index.js b/client/app/pages/admin/status/index.js index 6876688431..2167edbcad 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 1aad8a94d6..396c3357ce 100644 --- a/client/app/pages/admin/status/status.html +++ b/client/app/pages/admin/status/status.html @@ -43,5 +43,15 @@ +
+
+ +
diff --git a/redash/monitor.py b/redash/monitor.py index b164e33c97..080d20b3a7 100644 --- a/redash/monitor.py +++ b/redash/monitor.py @@ -32,4 +32,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