1
0
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:
Kunihiko Toumura 2021-09-05 15:22:13 +09:00
parent 401466d6c0
commit 490547cd3d

View File

@ -99,6 +99,11 @@ in your Node-RED user directory (${RED.settings.userDir}).
noprox = proxyConfig.noproxy;
}
let timingLog = false;
if (RED.settings.hasOwnProperty("httpRequestTimingLog")) {
timingLog = RED.settings.httpRequestTimingLog;
}
this.on("input",function(msg,nodeSend,nodeDone) {
checkNodeAgentPatch();
//reset redirectList on each request
@ -514,7 +519,9 @@ in your Node-RED user directory (${RED.settings.userDir}).
if (res.client && 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
@ -539,7 +546,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
}
msg.payload = err.toString() + " : " + url;
msg.statusCode = err.code || (err.response?err.response.statusCode:undefined);
if (node.metric()) {
if (node.metric() && timingLog) {
emitTimingMetricLog(err.timings, msg);
}
nodeSend(msg);