mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #33 from overleaf/em-swagger-fix
Log requests that don't have a route property
This commit is contained in:
commit
bf636047a3
2 changed files with 33 additions and 33 deletions
|
@ -18,36 +18,36 @@ module.exports.monitor = (logger) ->
|
|||
Metrics.timing("http_request", responseTimeMs, null, {method:req.method, status_code: res.statusCode, path:routePath})
|
||||
if requestSize
|
||||
Metrics.summary("http_request_size_bytes", requestSize, {method:req.method, status_code: res.statusCode, path:routePath})
|
||||
remoteIp = req.ip || req.socket?.socket?.remoteAddress || req.socket?.remoteAddress
|
||||
reqUrl = req.originalUrl || req.url
|
||||
referrer = req.headers['referer'] || req.headers['referrer']
|
||||
if STACKDRIVER_LOGGING
|
||||
info =
|
||||
httpRequest:
|
||||
requestMethod: req.method
|
||||
requestUrl: reqUrl
|
||||
requestSize: requestSize
|
||||
status: res.statusCode
|
||||
responseSize: res._headers?["content-length"]
|
||||
userAgent: req.headers["user-agent"]
|
||||
remoteIp: remoteIp
|
||||
referer: referrer
|
||||
latency:
|
||||
seconds: responseTime[0]
|
||||
nanos: responseTime[1]
|
||||
protocol: req.protocol
|
||||
else
|
||||
info =
|
||||
req:
|
||||
url: reqUrl
|
||||
method: req.method
|
||||
referrer: referrer
|
||||
"remote-addr": remoteIp
|
||||
"user-agent": req.headers["user-agent"]
|
||||
"content-length": req.headers["content-length"]
|
||||
res:
|
||||
"content-length": res._headers?["content-length"]
|
||||
statusCode: res.statusCode
|
||||
"response-time": responseTimeMs
|
||||
logger.info(info, "%s %s", req.method, reqUrl)
|
||||
remoteIp = req.ip || req.socket?.socket?.remoteAddress || req.socket?.remoteAddress
|
||||
reqUrl = req.originalUrl || req.url
|
||||
referrer = req.headers['referer'] || req.headers['referrer']
|
||||
if STACKDRIVER_LOGGING
|
||||
info =
|
||||
httpRequest:
|
||||
requestMethod: req.method
|
||||
requestUrl: reqUrl
|
||||
requestSize: requestSize
|
||||
status: res.statusCode
|
||||
responseSize: res._headers?["content-length"]
|
||||
userAgent: req.headers["user-agent"]
|
||||
remoteIp: remoteIp
|
||||
referer: referrer
|
||||
latency:
|
||||
seconds: responseTime[0]
|
||||
nanos: responseTime[1]
|
||||
protocol: req.protocol
|
||||
else
|
||||
info =
|
||||
req:
|
||||
url: reqUrl
|
||||
method: req.method
|
||||
referrer: referrer
|
||||
"remote-addr": remoteIp
|
||||
"user-agent": req.headers["user-agent"]
|
||||
"content-length": req.headers["content-length"]
|
||||
res:
|
||||
"content-length": res._headers?["content-length"]
|
||||
statusCode: res.statusCode
|
||||
"response-time": responseTimeMs
|
||||
logger.info(info, "%s %s", req.method, reqUrl)
|
||||
next()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "metrics-sharelatex",
|
||||
"version": "2.6.2",
|
||||
"version": "2.7.0",
|
||||
"description": "A drop-in metrics and monitoring module for node.js apps",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Loading…
Reference in a new issue