Skip to content

Instantly share code, notes, and snippets.

@mitallast
Created September 24, 2015 15:41
Show Gist options
  • Save mitallast/a888e4cdbc3f67e9db47 to your computer and use it in GitHub Desktop.
Save mitallast/a888e4cdbc3f67e9db47 to your computer and use it in GitHub Desktop.
sum by person example
; -*- mode: clojure; -*-
; vim: filetype=clojure
(logging/init {:file "/var/log/riemann/riemann.log"})
; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "127.0.0.1"]
(tcp-server {:host host})
(udp-server {:host host})
(ws-server {:host host}))
; Expire old events from the index every 5 seconds.
(periodically-expire 1)
(let [index (index)]
; Inbound events will be passed to these streams:
(streams
(where (service "dialog.client_question")
(by #(:person %)
(fixed-time-window 5
(smap folds/sum
#(info (str "sum " (:metric %) " person " (:person %)))
)
)
))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment