moved all metrics to use the module, deleting old metrics file and added different check in err domain

This commit is contained in:
Henry Oswald 2014-05-12 15:45:15 +01:00
parent 76f929f415
commit 3bbeff5aff
5 changed files with 5 additions and 28 deletions

View file

@ -37,8 +37,9 @@ app.use (req, res, next) ->
requestDomain.add req
requestDomain.add res
requestDomain.on "error", (err)->
metrics.inc "err.uncaught"
setTimeout(->
if !res.finished
if !res.headerSent
res.send(500)
, 3000)
logger = require('logger-sharelatex')

View file

@ -2,7 +2,7 @@ PersistorManager = require("./PersistorManager")
settings = require("settings-sharelatex")
logger = require("logger-sharelatex")
FileHandler = require("./FileHandler")
metrics = require("./metrics")
metrics = require("metrics-sharelatex")
oneDayInSeconds = 60 * 60 * 24
module.exports =

View file

@ -1,5 +1,5 @@
_ = require("underscore")
metrics = require("./metrics")
metrics = require("metrics-sharelatex")
logger = require("logger-sharelatex")
exec = require('child_process').exec
approvedFormats = ["png"]

View file

@ -3,7 +3,7 @@ uuid = require('node-uuid')
path = require("path")
_ = require("underscore")
logger = require("logger-sharelatex")
metrics = require("./metrics")
metrics = require("metrics-sharelatex")
module.exports =

View file

@ -1,24 +0,0 @@
StatsD = require('lynx')
settings = require('settings-sharelatex')
statsd = new StatsD('localhost', 8125, {on_error:->})
buildKey = (key)-> "filestore.#{process.env.NODE_ENV}.#{key}"
module.exports =
set : (key, value, sampleRate = 1)->
statsd.set buildKey(key), value, sampleRate
inc : (key, sampleRate = 1)->
statsd.increment buildKey(key), sampleRate
Timer : class
constructor :(key, sampleRate = 1)->
this.start = new Date()
this.key = buildKey(key)
done:->
timeSpan = new Date - this.start
statsd.timing(this.key, timeSpan, this.sampleRate)
gauge : (key, value, sampleRate = 1)->
statsd.gauge key, value, sampleRate