 
 
 (def ^ScheduledExecutorService scheduled-pool
-  (Executors/newSingleThreadScheduledExecutor
-   (create-thread-factory scheduled-pool-thread-format
-                          scheduled-pool-thread-counter
-                          true)))
+  (let [registry (SharedMetricRegistries/getOrCreate "github-bot-app")]
+    (InstrumentedScheduledExecutorService.
+     (Executors/newSingleThreadScheduledExecutor
+      (InstrumentedThreadFactory.
+       (create-thread-factory scheduled-pool-thread-format
+                              scheduled-pool-thread-counter
+                              true)
+       registry
+       "github-bot-app-scheduled-threads"))
+     registry
+     "github-bot-app-scheduled-pool")))
 
 (defn schedule
   [^Long delay ^TimeUnit time-unit ^Runnable r]



(def ^ExecutorService dispatch-pool
  (Executors/newCachedThreadPool
   (create-thread-factory dispatch-pool-thread-format
                          dispatch-pool-thread-counter)))


(defn dispatch

  (:import [java.util.concurrent Executors ExecutorService
                                 ScheduledExecutorService ThreadFactory
                                 TimeUnit]
           java.util.concurrent.atomic.AtomicInteger
           [com.codahale.metrics
            InstrumentedExecutorService
            InstrumentedScheduledExecutorService
            InstrumentedThreadFactory
            SharedMetricRegistries]))


(defn- create-thread-factory
