Skip to content

Instantly share code, notes, and snippets.

@ProTip
Created March 28, 2014 04:47
Show Gist options
  • Save ProTip/9825589 to your computer and use it in GitHub Desktop.
Save ProTip/9825589 to your computer and use it in GitHub Desktop.
(streams
; Index all events immediately.
; index
(where (service "http")
(where (not (expired? event))
(where (state "200")
(by :host
(runs 3 :state
index
prn))
(else
(with :state "critical"
(by :host
(runs 3 :state
index
prn)))))))
; Calculate an overall rate of events.
(with {:metric 1 :host nil :state "ok" :service "events/sec"}
(rate 5 index))
; Log expired events.
(expired
(fn [event] (info "expired" event))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment