Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Berlin 2013 - Riemann Workshop - Pierre-Yves Ri...

Monitorama
September 20, 2013
590

Berlin 2013 - Riemann Workshop - Pierre-Yves Ritschard

Monitorama

September 20, 2013
Tweet

Transcript

  1. • Riemann concepts • In-app events • System metrics •

    Just enough clojure • Common use cases Agenda
  2. Where do events come from • Your app • Collectd

    • Riemann-health • Logstash
  3. Configuration API Features • Percentiles • EWMA • Fixed /

    Moving event windows • Event coalescing • Many more
  4. Clojure (defn hello [name] (println “hello” name) (def a-map {:some-key

    “some value”}) (def an-array [0 1 2 :foo]) (def a-set #{:a :b :c}) (def a-pattern #”^(.*)[ \t]+=(.*)[ \t]+$”) (def inline-fn #(+ 3 %)) (def anon-fn (fn [a b] (+ a b)))
  5. Clojure (defn greeter [greeting] (fn [name] (println greeting “, “

    name))) (let [german-greeting (greeter “Hallo”)] (german-greeting “Rich”))
  6. Clojure (let [m {:foo 0 :bar 1} a [3 2

    1 0]] (conj a 4) ;; => (4 3 2 1 0) (assoc m :baz 2)) ;; => {:foo 0 :bar 1 :baz 2}
  7. Clojure (ns my-sql-query-ns (:require [clojure.data.jdbc :as jdbc] [clojure.data.jdbc.sql :as sql]))

    (jdbc/query mysql-db (sql/select * :users)) ;;=> ({:login “root” :uid 0} {:login :daemon :uid 1})
  8. Clojure (def lotsa-ones (repeat 1)) ;; => lazy-seq (take 5

    lotsa-ones) ;; => (1 1 1 1 1) (take 2 (interleave lotsa-ones (repeat 2))) ;; => (1 2)
  9. Clojure (def requests (atom 0)) (swap! requests inc) @request ;;

    => 1 (def user1 (ref 10)) (def user2 (ref 50)) (dosync (alter user1 + 10) (alter user2 - 10)) @user1 ;; => 20 @user2 ;; => 40
  10. Clojure (def users {:alice {:balance 10} :bob {:balance 5}}) (defn

    transaction [from to amount] (-> users (update-in [from :balance] - amount) (update-in [to :balance] + amount)))
  11. Streams (let [index (default {:ttl 60 :state “ok”} (update-index (index)))

    email (mailer {:from “riemann@production”})] (streams index (where (state “critical”) email) ))