Skip to content

Instantly share code, notes, and snippets.

@w01fe
Created October 1, 2012 02:53
Show Gist options
  • Save w01fe/3809219 to your computer and use it in GitHub Desktop.
Save w01fe/3809219 to your computer and use it in GitHub Desktop.
Monitoring a Graph
(defn observe-graph [g record-node-time!]
(into {}
(for [[k f] g]
[k
(with-meta
(fn [m]
(let [t0 (System/nanoTime)
v (f m)
t1 (System/nanoTime)]
(record-node-time! k (- t1 t0))
v))
(meta f))])))
(def observed-stats
(graph/eager-compile
(observe-graph stats-graph record-to-dashboard!)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment