                                  :requested-count 2
                                  :borrow-count 2
                                  :current-borrowed-instances 2})
-        (is (= (expected-metrics-values) (current-metrics-values)))
+
+        (let [expected-metrics (expected-metrics-values)
+              jruby-status-metrics (current-jruby-status-metrics)]
+          (is (= expected-metrics (current-metrics-values)))
+          (is (= expected-metrics (-> (current-jruby-status-metrics)
+                                      (jruby-status-metric-counters)))))
 
         ;; now we'll create a few more requests and tell them they may
         ;; try to proceed to the :borrowed-jruby phase; they won't


        (update-expected-values {:requested-count 2
                                 :current-requested-instances 2})
        (is (= (expected-metrics-values) (current-metrics-values)))

        ;; now, make sure we can see info about requests 3 and 4 in the
        ;; metrics
        (let [req-instances (vals @requested-instances)]
          (is (= #{"/foo/bar/async3" "/foo/baz/async4"}
                (set (map #(get-in % [:reason :request :uri]) req-instances))))
          (let [routes (set (map #(get-in % [:reason :request :route-info :route-id]) req-instances))]
            (is (= #{"foo-baz-:baz" "foo-bar-:bar"} routes)))
          (doseq [requested req-instances]
            (is (= :get (get-in requested [:reason :request :request-method])))
            (is (timestamp-after? start-time (:time requested)))))

        ;; finish the first two requests
        (coordinator/final-result coordinator 1)

  [coordinator request-id uri]
  (async-request coordinator request-id uri :request-complete)
  (coordinator/final-result coordinator request-id))

(defn current-jruby-status-metrics
  []
  (-> (str "http://localhost:8140/status/v1/"
           "services/jruby-metrics?level=debug")
      http-get
      :body
      (json/parse-string true)
      (get-in [:status :experimental :metrics])))

(defn jruby-status-metric-counters
  [jruby-status-metrics]
  (-> jruby-status-metrics
      (select-keys
       [:borrow-count
        :borrow-retry-count
        :borrow-timeout-count
        :num-free-jrubies
        :num-jrubies
        :requested-count
        :return-count])
      (assoc :current-borrowed-instances (count (:borrowed-instances
                                                 jruby-status-metrics))
             :current-requested-instances (count (:requested-instances
                                                  jruby-status-metrics)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Test services/mocks
