Source

metrics-clojure / metrics-clojure-core / src / metrics / counters.clj

Diff from to

metrics-clojure-core/src/metrics/counters.clj

   [title]
   (Metrics/newCounter (metric-name title)))
 
+(defmacro defcounter
+  "Define a new Counter metric with a givne title, or group, type and title."
+  ([title]
+     `(def ~title (counter ~(str title))))
+
+  ([group type title]
+     `(def ~title (counter ~(vec (map str [group type title]))))))
+
 
 ; Read ------------------------------------------------------------------------
 (defn value