mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
small cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user