                (= request-uri uri))
          (metrics-json request)
          (handler request))))))
-

      (header "Content-Type" "application/json"))))

(defn expose-metrics-as-json
  ([handler] (expose-metrics-as-json handler "/metrics"))
  ([handler uri]
   (fn [request]
     (let [request-uri (:uri request)]

(ns metrics.ring.expose
  (:import (com.yammer.metrics.core Gauge Timer Counter Histogram Meter))
  (:require [metrics.gauges :as gauges]
            [metrics.meters :as meters]
            [metrics.histograms :as histograms]
            [metrics.counters :as counters]
            [metrics.timers :as timers])
  (:use [ring.util.response :only [header response]]
        [metrics.utils :only [all-metrics]]
        [cheshire.core :only [generate-string]]))


; Define rendering protocol ---------------------------------------------------
