We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add to status page the size of Redash's DB
```sql
SELECT pg_size_pretty(pg_total_relation_size('query_results'));
```

```sql
SELECT pg_size_pretty(pg_database_size('redash'));
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `redash/monitor.py`
Content:
```
1 from redash import redis_connection, models, __version__, settings
2 
3 
4 def get_status():
5     status = {}
6     info = redis_connection.info()
7     status['redis_used_memory'] = info['used_memory']
8     status['redis_used_memory_human'] = info['used_memory_human']
9     status['version'] = __version__
10     status['queries_count'] = models.db.session.query(models.Query).count()
11     if settings.FEATURE_SHOW_QUERY_RESULTS_COUNT:
12         status['query_results_count'] = models.db.session.query(models.QueryResult).count()
13         status['unused_query_results_count'] = models.QueryResult.unused().count()
14     status['dashboards_count'] = models.Dashboard.query.count()
15     status['widgets_count'] = models.Widget.query.count()
16 
17     status['workers'] = []
18 
19     status['manager'] = redis_connection.hgetall('redash:status')
20 
21     queues = {}
22     for ds in models.DataSource.query:
23         for queue in (ds.queue_name, ds.scheduled_queue_name):
24             queues.setdefault(queue, set())
25             queues[queue].add(ds.name)
26 
27     status['manager']['queues'] = {}
28     for queue, sources in queues.iteritems():
29         status['manager']['queues'][queue] = {
30             'data_sources': ', '.join(sources),
31             'size': redis_connection.llen(queue)
32         }
33     
34     status['manager']['queues']['celery'] = {
35         'size': redis_connection.llen('celery'),
36         'data_sources': ''
37     }
38 
39     return status
40
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/redash/monitor.py b/redash/monitor.py
--- a/redash/monitor.py
+++ b/redash/monitor.py
@@ -1,39 +1,72 @@
 from redash import redis_connection, models, __version__, settings
 
 
-def get_status():
-    status = {}
+def get_redis_status():
     info = redis_connection.info()
-    status['redis_used_memory'] = info['used_memory']
-    status['redis_used_memory_human'] = info['used_memory_human']
-    status['version'] = __version__
+    return {'redis_used_memory': info['used_memory'], 'redis_used_memory_human': info['used_memory_human']}
+
+
+def get_object_counts():
+    status = {}
     status['queries_count'] = models.db.session.query(models.Query).count()
     if settings.FEATURE_SHOW_QUERY_RESULTS_COUNT:
         status['query_results_count'] = models.db.session.query(models.QueryResult).count()
         status['unused_query_results_count'] = models.QueryResult.unused().count()
     status['dashboards_count'] = models.Dashboard.query.count()
     status['widgets_count'] = models.Widget.query.count()
+    return status
 
-    status['workers'] = []
-
-    status['manager'] = redis_connection.hgetall('redash:status')
 
+def get_queues():
     queues = {}
     for ds in models.DataSource.query:
         for queue in (ds.queue_name, ds.scheduled_queue_name):
             queues.setdefault(queue, set())
             queues[queue].add(ds.name)
 
-    status['manager']['queues'] = {}
+    return queues
+
+
+def get_queues_status():
+    queues = get_queues()
+
     for queue, sources in queues.iteritems():
-        status['manager']['queues'][queue] = {
+        queues[queue] = {
             'data_sources': ', '.join(sources),
             'size': redis_connection.llen(queue)
         }
     
-    status['manager']['queues']['celery'] = {
+    queues['celery'] = {
         'size': redis_connection.llen('celery'),
         'data_sources': ''
     }
 
+    return queues
+
+
+def get_db_sizes():
+    database_metrics = []
+    queries = [
+        ['Query Results Size', "select pg_total_relation_size('query_results') as size from (select 1) as a"],
+        ['Redash DB Size', "select pg_database_size('postgres') as size"]
+    ]
+    for query_name, query in queries:
+        result = models.db.session.execute(query).first()
+        database_metrics.append([query_name, result[0]])
+
+    return database_metrics
+
+
+def get_status():
+    status = {
+        'version': __version__,
+        'workers': []
+    }
+    status.update(get_redis_status())
+    status.update(get_object_counts())
+    status['manager'] = redis_connection.hgetall('redash:status')
+    status['manager']['queues'] = get_queues_status()
+    status['database_metrics'] = {}
+    status['database_metrics']['metrics'] = get_db_sizes()
+
     return status

{"golden_diff": "diff --git a/redash/monitor.py b/redash/monitor.py\n--- a/redash/monitor.py\n+++ b/redash/monitor.py\n@@ -1,39 +1,72 @@\n from redash import redis_connection, models, __version__, settings\n \n \n-def get_status():\n-    status = {}\n+def get_redis_status():\n     info = redis_connection.info()\n-    status['redis_used_memory'] = info['used_memory']\n-    status['redis_used_memory_human'] = info['used_memory_human']\n-    status['version'] = __version__\n+    return {'redis_used_memory': info['used_memory'], 'redis_used_memory_human': info['used_memory_human']}\n+\n+\n+def get_object_counts():\n+    status = {}\n     status['queries_count'] = models.db.session.query(models.Query).count()\n     if settings.FEATURE_SHOW_QUERY_RESULTS_COUNT:\n         status['query_results_count'] = models.db.session.query(models.QueryResult).count()\n         status['unused_query_results_count'] = models.QueryResult.unused().count()\n     status['dashboards_count'] = models.Dashboard.query.count()\n     status['widgets_count'] = models.Widget.query.count()\n+    return status\n \n-    status['workers'] = []\n-\n-    status['manager'] = redis_connection.hgetall('redash:status')\n \n+def get_queues():\n     queues = {}\n     for ds in models.DataSource.query:\n         for queue in (ds.queue_name, ds.scheduled_queue_name):\n             queues.setdefault(queue, set())\n             queues[queue].add(ds.name)\n \n-    status['manager']['queues'] = {}\n+    return queues\n+\n+\n+def get_queues_status():\n+    queues = get_queues()\n+\n     for queue, sources in queues.iteritems():\n-        status['manager']['queues'][queue] = {\n+        queues[queue] = {\n             'data_sources': ', '.join(sources),\n             'size': redis_connection.llen(queue)\n         }\n     \n-    status['manager']['queues']['celery'] = {\n+    queues['celery'] = {\n         'size': redis_connection.llen('celery'),\n         'data_sources': ''\n     }\n \n+    return queues\n+\n+\n+def get_db_sizes():\n+    database_metrics = []\n+    queries = [\n+        ['Query Results Size', \"select pg_total_relation_size('query_results') as size from (select 1) as a\"],\n+        ['Redash DB Size', \"select pg_database_size('postgres') as size\"]\n+    ]\n+    for query_name, query in queries:\n+        result = models.db.session.execute(query).first()\n+        database_metrics.append([query_name, result[0]])\n+\n+    return database_metrics\n+\n+\n+def get_status():\n+    status = {\n+        'version': __version__,\n+        'workers': []\n+    }\n+    status.update(get_redis_status())\n+    status.update(get_object_counts())\n+    status['manager'] = redis_connection.hgetall('redash:status')\n+    status['manager']['queues'] = get_queues_status()\n+    status['database_metrics'] = {}\n+    status['database_metrics']['metrics'] = get_db_sizes()\n+\n     return status\n", "issue": "Add to status page the size of Redash's DB\n```sql\r\nSELECT pg_size_pretty(pg_total_relation_size('query_results'));\r\n```\r\n\r\n```sql\r\nSELECT pg_size_pretty(pg_database_size('redash'));\r\n```\n", "before_files": [{"content": "from redash import redis_connection, models, __version__, settings\n\n\ndef get_status():\n    status = {}\n    info = redis_connection.info()\n    status['redis_used_memory'] = info['used_memory']\n    status['redis_used_memory_human'] = info['used_memory_human']\n    status['version'] = __version__\n    status['queries_count'] = models.db.session.query(models.Query).count()\n    if settings.FEATURE_SHOW_QUERY_RESULTS_COUNT:\n        status['query_results_count'] = models.db.session.query(models.QueryResult).count()\n        status['unused_query_results_count'] = models.QueryResult.unused().count()\n    status['dashboards_count'] = models.Dashboard.query.count()\n    status['widgets_count'] = models.Widget.query.count()\n\n    status['workers'] = []\n\n    status['manager'] = redis_connection.hgetall('redash:status')\n\n    queues = {}\n    for ds in models.DataSource.query:\n        for queue in (ds.queue_name, ds.scheduled_queue_name):\n            queues.setdefault(queue, set())\n            queues[queue].add(ds.name)\n\n    status['manager']['queues'] = {}\n    for queue, sources in queues.iteritems():\n        status['manager']['queues'][queue] = {\n            'data_sources': ', '.join(sources),\n            'size': redis_connection.llen(queue)\n        }\n    \n    status['manager']['queues']['celery'] = {\n        'size': redis_connection.llen('celery'),\n        'data_sources': ''\n    }\n\n    return status\n", "path": "redash/monitor.py"}], "after_files": [{"content": "from redash import redis_connection, models, __version__, settings\n\n\ndef get_redis_status():\n    info = redis_connection.info()\n    return {'redis_used_memory': info['used_memory'], 'redis_used_memory_human': info['used_memory_human']}\n\n\ndef get_object_counts():\n    status = {}\n    status['queries_count'] = models.db.session.query(models.Query).count()\n    if settings.FEATURE_SHOW_QUERY_RESULTS_COUNT:\n        status['query_results_count'] = models.db.session.query(models.QueryResult).count()\n        status['unused_query_results_count'] = models.QueryResult.unused().count()\n    status['dashboards_count'] = models.Dashboard.query.count()\n    status['widgets_count'] = models.Widget.query.count()\n    return status\n\n\ndef get_queues():\n    queues = {}\n    for ds in models.DataSource.query:\n        for queue in (ds.queue_name, ds.scheduled_queue_name):\n            queues.setdefault(queue, set())\n            queues[queue].add(ds.name)\n\n    return queues\n\n\ndef get_queues_status():\n    queues = get_queues()\n\n    for queue, sources in queues.iteritems():\n        queues[queue] = {\n            'data_sources': ', '.join(sources),\n            'size': redis_connection.llen(queue)\n        }\n    \n    queues['celery'] = {\n        'size': redis_connection.llen('celery'),\n        'data_sources': ''\n    }\n\n    return queues\n\n\ndef get_db_sizes():\n    database_metrics = []\n    queries = [\n        ['Query Results Size', \"select pg_total_relation_size('query_results') as size from (select 1) as a\"],\n        ['Redash DB Size', \"select pg_database_size('postgres') as size\"]\n    ]\n    for query_name, query in queries:\n        result = models.db.session.execute(query).first()\n        database_metrics.append([query_name, result[0]])\n\n    return database_metrics\n\n\ndef get_status():\n    status = {\n        'version': __version__,\n        'workers': []\n    }\n    status.update(get_redis_status())\n    status.update(get_object_counts())\n    status['manager'] = redis_connection.hgetall('redash:status')\n    status['manager']['queues'] = get_queues_status()\n    status['database_metrics'] = {}\n    status['database_metrics']['metrics'] = get_db_sizes()\n\n    return status\n", "path": "redash/monitor.py"}]}