mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 10:41:15 +00:00
moved all metrics to use the module, deleting old metrics file and added different check in err domain
This commit is contained in:
parent
76f929f415
commit
3bbeff5aff
5 changed files with 5 additions and 28 deletions
|
@ -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')
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
_ = require("underscore")
|
||||
metrics = require("./metrics")
|
||||
metrics = require("metrics-sharelatex")
|
||||
logger = require("logger-sharelatex")
|
||||
exec = require('child_process').exec
|
||||
approvedFormats = ["png"]
|
||||
|
|
|
@ -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 =
|
||||
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in a new issue