Skip to content

Instantly share code, notes, and snippets.

@gumayunov
Last active October 15, 2015 15:48
Show Gist options
  • Save gumayunov/0bc918ef94a24a833d4e to your computer and use it in GitHub Desktop.
Save gumayunov/0bc918ef94a24a833d4e to your computer and use it in GitHub Desktop.
queue-monitoring.clj
(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