mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
commit
1816676e5c
3 changed files with 14 additions and 2 deletions
|
@ -6,10 +6,15 @@ hostname = require('os').hostname()
|
|||
|
||||
buildKey = (key)-> "#{name}.#{hostname}.#{key}"
|
||||
|
||||
destructors = []
|
||||
|
||||
module.exports =
|
||||
initialize: (_name) ->
|
||||
name = _name
|
||||
|
||||
registerDestructor: (func) ->
|
||||
destructors.push func
|
||||
|
||||
set : (key, value, sampleRate = 1)->
|
||||
statsd.set buildKey(key), value, sampleRate
|
||||
|
||||
|
@ -35,3 +40,7 @@ module.exports =
|
|||
http: require "./http"
|
||||
open_sockets: require "./open_sockets"
|
||||
|
||||
close: () ->
|
||||
for func in destructors
|
||||
func()
|
||||
statsd.close()
|
||||
|
|
|
@ -3,9 +3,12 @@ seconds = 1000
|
|||
|
||||
module.exports = OpenSocketsMonitor =
|
||||
monitor: (logger) ->
|
||||
setInterval () ->
|
||||
interval = setInterval () ->
|
||||
OpenSocketsMonitor.gaugeOpenSockets()
|
||||
, 5 * seconds
|
||||
Metrics = require "./metrics"
|
||||
Metrics.registerDestructor () ->
|
||||
clearInterval(interval)
|
||||
|
||||
gaugeOpenSockets: () ->
|
||||
Metrics = require "./metrics"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "metrics-sharelatex",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "A drop-in metrics and monitoring module for node.js apps",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Loading…
Reference in a new issue