Show errors when they occurs
This commit is contained in:
parent
4f429f5463
commit
64891674e1
3 changed files with 25 additions and 7 deletions
|
@ -159,6 +159,11 @@ Sometime you might want to get the maximum of some values during an interval of
|
||||||
|
|
||||||
That will display `{:foo 5}` in the resume.
|
That will display `{:foo 5}` in the resume.
|
||||||
|
|
||||||
|
## Open Issue
|
||||||
|
|
||||||
|
Sending a really huge number of timer events could lead to a stack overflow.
|
||||||
|
Just add more size to your stack `-Xss16m`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright © 2015 Yann Esposito
|
Copyright © 2015 Yann Esposito
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(defproject bigbrother "0.1.3-SNAPSHOT"
|
(defproject bigbrother "0.1.3"
|
||||||
:description "Periodically send metrics"
|
:description "Periodically send metrics"
|
||||||
:url "http://github.com/yogsototh/bigbrother"
|
:url "http://github.com/yogsototh/bigbrother"
|
||||||
:license {:name "MIT"
|
:license {:name "MIT"
|
||||||
|
|
|
@ -150,10 +150,22 @@ end
|
||||||
(defn display-time
|
(defn display-time
|
||||||
"display the time at most every 10s"
|
"display the time at most every 10s"
|
||||||
[nb-ms]
|
[nb-ms]
|
||||||
|
(try
|
||||||
(let [result (resume-map nb-ms)]
|
(let [result (resume-map nb-ms)]
|
||||||
(log/info (json/write-str result))
|
(log/info (json/write-str result))
|
||||||
(send-to-riemann result)
|
(send-to-riemann result)
|
||||||
(reset-accumulators!)))
|
(reset-accumulators!))
|
||||||
|
(catch Throwable t
|
||||||
|
(log/error t)
|
||||||
|
; (.printStackTrace t)
|
||||||
|
)))
|
||||||
|
|
||||||
|
(defn protected [f]
|
||||||
|
(try (f)
|
||||||
|
(catch Throwable t
|
||||||
|
(log/error t)
|
||||||
|
; (.printStackTrace t)
|
||||||
|
(protected f))))
|
||||||
|
|
||||||
(defn init-metrics
|
(defn init-metrics
|
||||||
"## init-metrics
|
"## init-metrics
|
||||||
|
@ -169,4 +181,5 @@ end
|
||||||
(reset! riemann-service riemann-service-name)
|
(reset! riemann-service riemann-service-name)
|
||||||
(when riemann-host
|
(when riemann-host
|
||||||
(reset! riemann-conn (r/tcp-client {:host riemann-host})))
|
(reset! riemann-conn (r/tcp-client {:host riemann-host})))
|
||||||
(every nb-ms-metrics (fn [] (display-time nb-ms-metrics)) @pool))
|
(protected
|
||||||
|
#(every nb-ms-metrics (fn [] (display-time nb-ms-metrics)) @pool)))
|
||||||
|
|
Loading…
Reference in a new issue