Last active
October 15, 2015 15:48
-
-
Save gumayunov/0bc918ef94a24a833d4e to your computer and use it in GitHub Desktop.
queue-monitoring.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- queue-stuck? | |
[events] | |
(comment "простейшая проверка, что очередь не стала меньше")) | |
(defn- make-alert-event | |
[events] | |
(merge (first events) { :state "major" :description (str "Смотрите как все плохо " events)})) | |
(defn- when-stuck | |
[children] | |
(fn [events] | |
(if queue-stuck?(events) | |
(call-resque make-alert-event(events) children)))) | |
(let [queue-monitoring | |
(tagged "queues-monitor" | |
(by [:service :host] | |
(moving-time-window 300 | |
(queue-monitoring/when-stuck tell-ops))))] | |
(streams | |
(io #(info "New event" %)) | |
queue-monitoring)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment