mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Use httpRequestTimingLog for enable detailed timing log
This commit is contained in:
parent
401466d6c0
commit
490547cd3d
@ -99,6 +99,11 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|||||||
noprox = proxyConfig.noproxy;
|
noprox = proxyConfig.noproxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let timingLog = false;
|
||||||
|
if (RED.settings.hasOwnProperty("httpRequestTimingLog")) {
|
||||||
|
timingLog = RED.settings.httpRequestTimingLog;
|
||||||
|
}
|
||||||
|
|
||||||
this.on("input",function(msg,nodeSend,nodeDone) {
|
this.on("input",function(msg,nodeSend,nodeDone) {
|
||||||
checkNodeAgentPatch();
|
checkNodeAgentPatch();
|
||||||
//reset redirectList on each request
|
//reset redirectList on each request
|
||||||
@ -514,7 +519,9 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|||||||
if (res.client && res.client.bytesRead) {
|
if (res.client && res.client.bytesRead) {
|
||||||
node.metric("size.bytes", msg, res.client.bytesRead);
|
node.metric("size.bytes", msg, res.client.bytesRead);
|
||||||
}
|
}
|
||||||
emitTimingMetricLog(res.timings, msg);
|
if (timingLog) {
|
||||||
|
emitTimingMetricLog(res.timings, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert the payload to the required return type
|
// Convert the payload to the required return type
|
||||||
@ -539,7 +546,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|||||||
}
|
}
|
||||||
msg.payload = err.toString() + " : " + url;
|
msg.payload = err.toString() + " : " + url;
|
||||||
msg.statusCode = err.code || (err.response?err.response.statusCode:undefined);
|
msg.statusCode = err.code || (err.response?err.response.statusCode:undefined);
|
||||||
if (node.metric()) {
|
if (node.metric() && timingLog) {
|
||||||
emitTimingMetricLog(err.timings, msg);
|
emitTimingMetricLog(err.timings, msg);
|
||||||
}
|
}
|
||||||
nodeSend(msg);
|
nodeSend(msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user