Skip to content

Instantly share code, notes, and snippets.

@rboyd
Last active January 30, 2019 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rboyd/de554c7cdc977cc827a19a071c297ad4 to your computer and use it in GitHub Desktop.
Save rboyd/de554c7cdc977cc827a19a071c297ad4 to your computer and use it in GitHub Desktop.
(defn instrument-resolvers!
"Look for any fns matching the pattern resolve-.* in the ns*, instrument them with
iapetos for Prometheus monitoring."
[ns* registry]
(doseq [resolver-str (filter #(re-matches #"resolve-.*" (str %)) (keys (ns-publics (ns-name ns*))))]
(->> resolver-str symbol resolve (iapetos.collector.fn/instrument! registry))))
(instrument-resolvers! *ns* registry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment