Merge pull request #3 from sharelatex/event-loop-monitor

added monitoring of event loop time
This commit is contained in:
Brian Gough 2015-06-23 13:21:04 +01:00
commit 78f429f2b5
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,18 @@
seconds = 1000
module.exports = EventLoopMonitor =
monitor: (logger) ->
interval = setInterval () ->
EventLoopMonitor.Delay()
, 1 * seconds
Metrics = require "./metrics"
Metrics.registerDestructor () ->
clearInterval(interval)
Delay: () ->
Metrics = require "./metrics"
t1 = process.hrtime()
setImmediate () ->
delta = process.hrtime(t1)
responseTime = delta[0]*1e6 + delta[1]*1e-3
Metrics.timing("event-loop-microsec", responseTime)

View file

@ -39,6 +39,7 @@ module.exports =
mongodb: require "./mongodb"
http: require "./http"
open_sockets: require "./open_sockets"
event_loop: require "./event_loop"
close: () ->
for func in destructors