mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add timing log
This commit is contained in:
parent
f1e7ec0c6b
commit
401466d6c0
@ -514,6 +514,7 @@ 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);
|
||||
}
|
||||
|
||||
// Convert the payload to the required return type
|
||||
@ -538,6 +539,9 @@ 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()) {
|
||||
emitTimingMetricLog(err.timings, msg);
|
||||
}
|
||||
nodeSend(msg);
|
||||
nodeDone();
|
||||
});
|
||||
@ -547,6 +551,28 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
node.status({});
|
||||
});
|
||||
|
||||
function emitTimingMetricLog(timings, msg) {
|
||||
const props = [
|
||||
"start",
|
||||
"socket",
|
||||
"lookup",
|
||||
"connect",
|
||||
"secureConnect",
|
||||
"upload",
|
||||
"response",
|
||||
"end",
|
||||
"error",
|
||||
"abort"
|
||||
];
|
||||
if (timings) {
|
||||
props.forEach(p => {
|
||||
if (timings[p]) {
|
||||
node.metric(`timings.${p}`, msg, timings[p]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function extractCookies(setCookie) {
|
||||
var cookies = {};
|
||||
setCookie.forEach(function(c) {
|
||||
|
Loading…
Reference in New Issue
Block a user