Source

metrics-clojure / metrics-clojure-ring / src / metrics / ring / expose.clj

Diff from to

metrics-clojure-ring/src/metrics/ring/expose.clj

   (:use [cheshire.core :only [generate-string]]))
 
 
+; Define rendering protocol ---------------------------------------------------
 (defprotocol RenderableMetric
   (render-to-basic [metric] "Turn a metric into a basic Clojure datastructure."))
 
     {:type :counter
      :value (counters/value c)}))
 
+
+; Utils -----------------------------------------------------------------------
 (defn- ensure-leading-slash [s]
   (if (not= \/ (first s))
     (str \/ s)
 (defn- render-metric [[metric-name metric]]
   [metric-name (render-to-basic metric)])
 
+
+; Exposing --------------------------------------------------------------------
 (defn- metrics-json [request]
   (let [metrics-map (into {} (map render-metric (all-metrics)))
         json (generate-string metrics-map)]