Make Function duration status optional

This commit is contained in:
Nick O'Leary 2015-02-04 10:01:46 +00:00
parent 6b96c1876a
commit f462446213
1 changed files with 4 additions and 4 deletions

View File

@ -61,10 +61,10 @@ module.exports = function(RED) {
} }
} }
this.send(results); this.send(results);
if (RED.settings.metricsOn && (RED.settings.metricsOn === true)) { var duration = process.hrtime(start);
var duration = process.hrtime(start); var converted = Math.floor((duration[0]* 1e9 + duration[1])/10000)/100;
var converted = Math.floor((duration[0]* 1e9 + duration[1])/10000)/100; this.metric("duration", msg, converted);
this.metric("duration", results, converted); if (process.env.NODE_RED_FUNCTION_TIME) {
this.status({fill:"yellow",shape:"dot",text:""+converted}); this.status({fill:"yellow",shape:"dot",text:""+converted});
} }
} catch(err) { } catch(err) {