mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-15 05:21:57 +00:00
small cleanup
This commit is contained in:
parent
85d4b03bcb
commit
93f4a7eeaf
3 changed files with 3 additions and 7 deletions
|
@ -10,8 +10,6 @@ module.exports.monitor = (logger) ->
|
|||
responseTime = new Date() - startTime
|
||||
if req.route?.path?
|
||||
routePath = req.route.path.toString().replace(/\//g, '_').replace(/\:/g, '').slice(1)
|
||||
key = "http-requests.#{routePath}.#{req.method}.#{res.statusCode}"
|
||||
|
||||
Metrics.timing("http_request", responseTime, null, {method:req.method, status_code: res.statusCode, path:routePath})
|
||||
logger.log
|
||||
req:
|
||||
|
|
|
@ -11,8 +11,6 @@ hostname = require('os').hostname()
|
|||
buildKey = (key)-> "#{name}.#{hostname}.#{key}"
|
||||
buildGlobalKey = (key)-> "#{name}.global.#{key}"
|
||||
|
||||
|
||||
|
||||
promMetrics = {}
|
||||
|
||||
destructors = []
|
||||
|
|
|
@ -25,15 +25,15 @@ module.exports = (obj, methodName, prefix, logger) ->
|
|||
logger.log "[Metrics] expected wrapped method '#{methodName}' to be invoked with a callback"
|
||||
return realMethod.apply this, originalArgs
|
||||
|
||||
timer = new metrics.Timer(startPrefix, null, {method: modifedMethodName})
|
||||
timer = new metrics.Timer(startPrefix, 1, {method: modifedMethodName})
|
||||
|
||||
realMethod.call this, firstArgs..., (callbackArgs...) ->
|
||||
elapsedTime = timer.done()
|
||||
possibleError = callbackArgs[0]
|
||||
if possibleError?
|
||||
metrics.inc "#{startPrefix}_result", null, {status:"failed", method: modifedMethodName}
|
||||
metrics.inc "#{startPrefix}_result", 1, {status:"failed", method: modifedMethodName}
|
||||
else
|
||||
metrics.inc "#{startPrefix}_result", null, {status:"success", method: modifedMethodName}
|
||||
metrics.inc "#{startPrefix}_result", 1, {status:"success", method: modifedMethodName}
|
||||
if logger?
|
||||
loggableArgs = {}
|
||||
try
|
||||
|
|
Loading…
Reference in a new issue