mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #3 from sharelatex/event-loop-monitor
added monitoring of event loop time
This commit is contained in:
commit
78f429f2b5
2 changed files with 19 additions and 0 deletions
18
libraries/metrics/event_loop.coffee
Normal file
18
libraries/metrics/event_loop.coffee
Normal 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)
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue