        (let [tables (get params "tables[]" [])
              tables (if (instance? String tables) [tables] tables)]
          (response
-           (regions-by-servers (:regions @cached)
+           (regions-by-servers (:regions @cached) (:servers @cached)
                                (keyword metric) (keyword sort) tables))))
   (GET "/table_regions.json"
        {{:keys [sort metric]

  "Generates output for /table_regions.json. Regions grouped by their tables."
  [regions metric sort]
  (let [;; Exclude hbase:meta table
        all-regions (filter (complement :meta?) (:regions @cached))
        ;; Sort the regions
        sorted-regions (if (= sort :metric)
                         (reverse (sort-by metric all-regions))

(ns hbase-region-inspector.core
  (:require [clojure.string :as str]
            [ring.adapter.jetty :refer [run-jetty]]
            [ring.util.response :refer [response content-type resource-response]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults site-defaults]]
