 (defn- database-metrics
   "Get metrics based on databases"
   []
-  (let [databases (db/select 'Database)]
+  (let [databases (db/select ['Database :id :is_full_sync])]
     {:databases (apply add-summaries (map database-dims databases))}))
 
 
 (defn- table-metrics
   "Get metrics based on tables"
   []
-  (let [tables (db/select 'Table)]
+  (let [tables (db/select ['Table :id :db_id :schema])]
     {:tables (count tables)
      :num_per_database (medium-histogram tables :db_id)
      :num_per_schema (medium-histogram tables :schema)}))

  "Get metrics based on questions
  TODO characterize by # executions and avg latency"
  []
  (let [questions (db/select 'Card)]
    {:questions (apply add-summaries (map question-dims questions))}))

(defn- dashboard-metrics
  "Get metrics based on dashboards
  TODO characterize by # of revisions, and created by an admin"
  []
  (let [dashboards (db/select 'Dashboard)
        dashcards (db/select 'DashboardCard)]
    {:dashboards (count dashboards)
     :num_dashs_per_user (medium-histogram dashboards :creator_id)
     :num_cards_per_dash (medium-histogram dashcards :dashboard_id)

  "Get metrics based on user records
  TODO: get activity in terms of created questions, pulses and dashboards"
  []
  (let [users (db/select ['User :is_active :is_superuser :last_login :google_auth])]
    {:users (apply add-summaries (map user-dims users))}))


