much more background process tracking
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
(ns auto-ap.utils
|
||||
#?@
|
||||
(:clj
|
||||
[(:require [com.unbounce.dogstatsd.core :as statsd])]))
|
||||
[(:require [com.unbounce.dogstatsd.core :as statsd]
|
||||
[clojure.tools.logging :as log]
|
||||
[unilog.context :as lc])]))
|
||||
|
||||
(defn by
|
||||
([f xs]
|
||||
@@ -87,9 +89,19 @@
|
||||
(defn heartbeat [f id]
|
||||
(fn []
|
||||
#?(:clj (do
|
||||
(f)
|
||||
(statsd/service-check {:name (str id)
|
||||
:status :ok}
|
||||
nil))
|
||||
(lc/with-context {:source id}
|
||||
(try
|
||||
(log/info "Starting background process " id)
|
||||
(f)
|
||||
(log/info "Completed background process " id)
|
||||
(statsd/service-check {:name (str id)
|
||||
:status :ok}
|
||||
nil)
|
||||
(catch Exception e
|
||||
(log/error e)
|
||||
(statsd/service-check {:name (str id)
|
||||
:status :critical}
|
||||
nil)))))
|
||||
|
||||
:cljs (do (println "Heartbeat for " id)
|
||||
(f)))))
|
||||
|
||||
Reference in New Issue
Block a user