     (io.prometheus.client Counter Histogram Counter$Child Histogram$Child CollectorRegistry Gauge Gauge$Child)))
 
 ; more useful set of buckets for microservice APIs than the defaults provided by the Histogram class
-(def histogram-buckets (atom [0.001, 0.005, 0.010, 0.020, 0.050, 0.100, 0.200, 0.300, 0.500, 0.750, 1, 5]))
-
-(defn- ^Counter make-request-counter [app-name registry]
-  (-> (Counter/build)
-      (.namespace app-name)
-      (.name "http_requests_total")
-      (.labelNames (into-array String ["method" "status" "statusClass" "path"]))
-      (.help "A counter of the total number of HTTP requests processed.")
-      (.register registry)))
-
-(defn- ^Histogram make-request-histogram [app-name registry]
-  (-> (Histogram/build)
-      (.buckets (double-array @histogram-buckets))
-      (.namespace app-name)
-      (.name "http_request_latency_seconds")
-      (.labelNames (into-array String ["method" "status" "statusClass" "path"]))
-      (.help "A histogram of the response latency for HTTP requests in seconds.")
-      (.register registry)))
+(def request-latency-histogram-buckets (atom [0.001, 0.005, 0.010, 0.020, 0.050, 0.100, 0.200, 0.300, 0.500, 0.750, 1, 5]))
 
 (defn- ^Counter$Child counter-with-labels [^Counter counter label-array] (.labels counter (into-array String label-array)))
 

      response)
    response))

(defn- record-request-metric [counter histogram request-method response-status request-time response-path]
  (let [status-class (str (int (/ response-status 100)) "XX")
        method-label (string/upper-case (name request-method))
        labels [method-label (str response-status) status-class response-path]]
    (-> (histogram-with-labels histogram labels) (.observe request-time))
    (-> (counter-with-labels counter labels) (.inc))))

(defn instrument-handler
  "Ring middleware to record request metrics"
  [handler ^String app-name ^CollectorRegistry registry]
  (let [counter (make-request-counter app-name registry)
        histogram (make-request-histogram app-name registry)]
    (fn [request]
      (let [request-method (:request-method request)
            start-time (System/currentTimeMillis)

            response-status (get response :status 404)
            response-path (get (meta response) :path "unspecified")
            request-time (/ (double (- finish-time start-time)) 1000.0)]
        (record-request-metric metrics-store app-name request-method response-status request-time response-path)
        response))))

(defn dump-metrics
