How to monitor Each node-red workflow execution time

I created multiple workflows in node-red window. Now i want know each workflow execution time and how can I monitor in runtime? Is it possible? If yes please let me know. Thanks.

You can DIY it.

This is an example I did before using a subflow to measure and report time taken of sorting 2600 rows in a function VS JSONata...

and this is the results (viewed in the context viewer)...


You can re-use the subflow over and over (just set a different name and set operation "start" or "stop")

This is the test data I used for this example if you want to try it out array2616.json (3.4 MB)

[{"id":"33606bab.ba2474","type":"subflow","name":"flow-performance (2)","info":"","category":"","in":[{"x":80,"y":100,"wires":[{"id":"7ad542e4.a76adc"}]}],"out":[{"x":440,"y":100,"wires":[{"id":"7ad542e4.a76adc","port":0}]}],"env":[{"name":"name","type":"str","value":"measure","ui":{"icon":"font-awesome/fa-tag","label":{"en-US":"Name"},"type":"input","opts":{"types":["str","env"]}}},{"name":"operation","type":"str","value":"start","ui":{"icon":"font-awesome/fa-cog","label":{"en-US":"Operation"},"type":"select","opts":{"opts":[{"l":{"en-US":"start"},"v":"start"},{"l":{"en-US":"stop"},"v":"stop"},{"l":{"en-US":"msg.topic"},"v":"msg.topic"},{"l":{"en-US":"msg.operation"},"v":"msg.operation"},{"l":{"en-US":"msg.payload"},"v":"msg.payload"}]}}}]},{"id":"7ad542e4.a76adc","type":"function","z":"33606bab.ba2474","name":"do operation","func":"var name = msg.perfName || env.get(\"name\");\nvar operation = msg.perfOperation || env.get(\"operation\");\nvar measures = global.get(\"flow-performance\") || {};\nvar measure = measures[name] || {};\n\nfunction doOp(measure, op){\n    if(operation === \"start\"){\n        measure.start =;//change to process.hrtime\n        measure.stop = null;\n        measure.durationMs = null;\n    } else if(operation === \"stop\") {\n        measure.stop =;//change to process.hrtime\n        measure.durationMs = measure.start ? measure.stop - measure.start : null;\n        msg._performance = measure;\n    }\n}\n\n\nif(operation === \"start\"){\n    doOp(measure, operation);\n} else if(operation === \"stop\") {\n    doOp(measure, operation);\n} else if(operation === \"msg.topic\") {\n    operation = msg.topic;\n    doOp(measure, operation);\n} else if(operation === \"msg.operation\") {\n    operation = msg.operation;\n    doOp(measure, operation);\n} else if(operation === \"msg.payload\") {\n    operation = msg.payload;\n    doOp(measure, operation);\n} else {\n    return msg;    \n}\nmeasures[name] = measure;\nglobal.set(\"flow-performance\", measures);\n\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":100,"wires":[[]]},{"id":"f31621c0.e02bc","type":"file in","z":"d1c281e9.1a622","name":"","filename":"c:/temp/array2616.json","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":360,"y":900,"wires":[["7c84f547.f647bc"]]},{"id":"2c2bdd4c.a5c982","type":"inject","z":"d1c281e9.1a622","name":"function","topic":"function","payload":"function","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":880,"wires":[["f31621c0.e02bc"]]},{"id":"7c84f547.f647bc","type":"json","z":"d1c281e9.1a622","name":"","property":"payload","action":"","pretty":false,"x":570,"y":900,"wires":[["d37f1307.cca77","78849167.f423f"]]},{"id":"d37f1307.cca77","type":"debug","z":"d1c281e9.1a622","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":900,"wires":[]},{"id":"ecde8486.5d8b88","type":"inject","z":"d1c281e9.1a622","name":"JSONata","topic":"JSONata","payload":"JSONata","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":920,"wires":[["f31621c0.e02bc"]]},{"id":"78849167.f423f","type":"switch","z":"d1c281e9.1a622","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"function","vt":"str"},{"t":"eq","v":"JSONata","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":1020,"wires":[["89758fac.b0b51"],["7267f28f.d402ec"]]},{"id":"89758fac.b0b51","type":"subflow:33606bab.ba2474","z":"d1c281e9.1a622","name":"normalFunction","env":[{"name":"name","value":"normalFunction","type":"str"}],"x":500,"y":980,"wires":[["f67a1417.3ed168"]]},{"id":"bcb1529a.c3b7c","type":"subflow:33606bab.ba2474","z":"d1c281e9.1a622","name":"normalFunction","env":[{"name":"name","value":"normalFunction","type":"str"},{"name":"operation","value":"stop","type":"str"}],"x":880,"y":980,"wires":[["c0a47f96.88b78"]]},{"id":"7267f28f.d402ec","type":"subflow:33606bab.ba2474","z":"d1c281e9.1a622","name":"JSONata","env":[{"name":"name","value":"JSONata","type":"str"}],"x":480,"y":1020,"wires":[["cf2c17fc.268638"]]},{"id":"ef70e043.5cdd6","type":"subflow:33606bab.ba2474","z":"d1c281e9.1a622","name":"JSONata","env":[{"name":"name","value":"JSONata","type":"str"},{"name":"operation","value":"stop","type":"str"}],"x":860,"y":1020,"wires":[["9a33b12b.dd89b"]]},{"id":"f67a1417.3ed168","type":"function","z":"d1c281e9.1a622","name":"","func":"msg.payload.sort((a,b) => {\n    if(a.age < b.age){\n        return -1;\n    }else if(a.age > b.age){\n        return 1;\n    }else{\n        return 0;\n    }\n})\n\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":980,"wires":[["bcb1529a.c3b7c"]]},{"id":"cf2c17fc.268638","type":"change","z":"d1c281e9.1a622","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload^(age)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":1020,"wires":[["ef70e043.5cdd6"]]},{"id":"c0a47f96.88b78","type":"debug","z":"d1c281e9.1a622","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1050,"y":980,"wires":[]},{"id":"9a33b12b.dd89b","type":"debug","z":"d1c281e9.1a622","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1050,"y":1020,"wires":[]},{"id":"2259f174.7c6d7e","type":"comment","z":"d1c281e9.1a622","name":"measure time it takes for Function node VS JSONata","info":"","x":490,"y":840,"wires":[]}]
1 Like

How can I know the last execution time, last message, last process etc for all the workflows at the same interface and same time? How can I develop this?

Try updating the subflow to log extra information.

The limit is your imagination.

I forgot to add the flow to the original message - oops (will edit it now)

Original post updated above to include the flow

In the above image. I created multiple flows i want to know each flow execution time in the same interface

So import the flow i posted, deleted everything expept the subflow, drop 1 subflow instance in-line with your flow before the part to measure (set 'operation' to "start") and one after the part of flow to measure (set 'operation' to "stop").

make sure each pair of start/stop nodes have same name

run your flows

look in the context viewer

Is there any possibility to see in the dashboard ?

Of course!

If the values are in node-red, you can do whatever you want.

I suggest you get things measuring first, then worry about how to present them on a dashboard later once you have numbers (just knowing it can be done is enough for now)

Can you show one example for dashboard. Because I am a beginner to Node Red.

Nope - afraid not!

There are hundreds of posts in the forum and there are LOTS of youtube videos / web pages on dashboard.

There are demo flows here

The best way to learn is by doing - try something.

when you get stuck, raise a new question on the forum asking a specific question with a good / relevant title (in the dashboard category).

As you can see here, There are many workflows in the top bar. And I have opened Node-Red Metrics work flow. So my question is currently, I need to go to each work flow to check it is working properly, what data it is sending, at what time it has performed any action, are there any errors etc. So, what I want to try is to handle everything of these for all the work flows at a same interface and not by going to each tab separately. This is because, if after some time there are like hundreds of work flows in my NODE RED, it will be very difficult and time consuming to check each flow by clicking on its tab. Thats what I want to say, is how can I monitor these all workflows at the same time, to check which workflow is performing any action, are there any errors, what outputs are being sent for all of them? Did I make it clear about my problem? Please let me know how to proceed

Take a look at the catch node for checking for errors

So first you ask "How to monitor Each node-red workflow execution time" - I give you a method.

Now you say...

I said, dont worry about dashboard - you can achieve that once you have measurements/numbers

As I said, once you are measuring things, it is an simple case of presenting the data/metrics you gather on a dashboard.

Bottom line - there is NO SIMPLE DROP IN SOLUTION - you need to measure performance, / capture data / catch errors etc - store them somewhere (like global context or a database) THEN arrange them on a dashboard YOURSELF.

The reason there is NO SIMPLE DROP IN SOLUTION - is because no one has ever designed a flow the same as yours - it is unique - and needs a unique solution.

1 Like

Thank you for everything.But my question same like as below

The answer is that you'll have to do a lot of work to do this - there is no magic, easy solution sorry


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.