     (let [tpool (get-thread-pool options)
           mstore (mstore/cassandra-metric-store cass-hosts options)
           pstore (pstore/elasticsearch-path-store es-url options)
+          sort (get-sort-or-not-fn (:sort options))
           obsolete-data (->> (get-paths pstore tenant paths
                                         (:exclude-paths options)
                                         (:sort options))
                              (filter-obsolete-metrics mstore tpool tenant
                                                       rollups options)
                              (get-paths-from-paths-rollups)
-                             (distinct))]
+                             (distinct)
+                             (sort))]
       (newline)
       (dorun (map println obsolete-data)))
     (catch Exception e

        from (timec/to-epoch (time/minus (time/now) (time/seconds threshold)))
        title "Checking metrics"
        paths-rollups (combine-paths-rollups paths [(first rollups)])
        sort (if (:sort options) sort #(do %))]
    (prog/set-progress-bar!
     "[:bar] :percent :done/:total Elapsed :elapseds ETA :etas")
    (prog/config-progress-bar! :width pbar-width)

  []
  (swap! inspecting? (fn [_] true)))

(defn- get-sort-or-not-fn
  [sort?]
  (if sort? sort #(do %)))

(defn- lookup-paths
  "Lookup paths."
  [pstore tenant leafs-only limit-depth paths exclude-paths sort-paths?
   & [sidefx-fn]]
  (let [lookup-fn #(pstore/lookup pstore tenant leafs-only limit-depth %
                                  exclude-paths)
        sidefx-wrapper (if sidefx-fn #(do (sidefx-fn %) %) #(do %))
        sort (get-sort-or-not-fn sort-paths?)]
    (sort (map :path (map sidefx-wrapper (flatten (map lookup-fn paths)))))))

(defn- get-paths
  "Get paths."
  [pstore tenant paths-to-lookup exclude-paths sort-paths? & [sidefx-fn]]
  (let [paths (lookup-paths pstore tenant false false paths-to-lookup
                            exclude-paths sort-paths? sidefx-fn)
        title "Getting paths"]
    (newline)
    (clog/info (str title "..."))
