Skip to content

Instantly share code, notes, and snippets.

@aaronfeng
Last active December 11, 2015 09:39
Show Gist options
  • Save aaronfeng/4581695 to your computer and use it in GitHub Desktop.
Save aaronfeng/4581695 to your computer and use it in GitHub Desktop.
(let [hosts (atom {})]
(fn [event]
(let [tag-str (keyword (clojure.string/join "-" (:tags event)))]
(swap! hosts assoc tag-str (conj (tag-str @hosts #{}) (:host event)))
(index {:service (str (name tag-str) "-count")
:time (unix-time)
:metric (count (tag-str @hosts))}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment