Feature Request: Get list of used keys of context variables

355 views
Skip to first unread message

Sebastian Barwe

unread,
Jan 29, 2017, 8:46:03 AM1/29/17
to Node-RED
For debugging purposes / monitoring it would be great to have a method "getKeys" on the node/flow/global context.
My usecase is that I have a installation where I do not have a dev environment - it just still runs in the background and I do not want to flood logs with runtime trace (the development is at an early stage).
I therefore would like to use the context to save some runtime data (counter, lastvalues, states)  from my function nodes which is much faster.
To make them available to me (from a monitoring perspective) I would like to just get every value of the contexts - but this only possible for variables which are directly appended to the context object and not via the recommended get/set methods.

As I do not like to modify/patch core code of node-red because I would need to track it over updates etc. It would be great to have the following line near https://github.com/node-red/node-red/blob/master/red/runtime/nodes/context.js#L30

obj.getKeys = function() { return Object.getOwnPropertyNames(data); }



Sebastian Barwe

unread,
Feb 5, 2017, 1:44:09 PM2/5/17
to Node-RED


 Just push myself, if there is any chance to see this method on conext ever ? :)

Nick O'Leary

unread,
Feb 5, 2017, 1:50:54 PM2/5/17
to Node-RED

It appears a sensible thing. Just need to think about what effect it would have on the plans to provide a storage plugin for persisting the context data.

Nick


On Sun, 5 Feb 2017, 18:44 Sebastian Barwe, <sebasti...@gmail.com> wrote:


 Just push myself, if there is any chance to see this method on conext ever ? :)

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/a66d19ca-0727-462d-99d4-29f6e7b7a2bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jan Van den Audenaerde

unread,
Feb 16, 2017, 2:40:44 AM2/16/17
to Node-RED
Hi, 

I just had a look at the node-red-contrib-contextbrowser.  The ability to be able to check the contents of the node/flow/context variables sounds a cool feature to me.
As this requires a one-line modification of Node-Red, I think it is worth considering this modification.

kr
Jan.

Nick O'Leary

unread,
Feb 16, 2017, 2:53:51 AM2/16/17
to Node-RED

As per my previous reply, I agree it will be useful, but this isn't a one line addition and has wider implications to consider before adding it.

Nick


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Peter Scargill

unread,
Mar 8, 2017, 5:13:49 AM3/8/17
to Node-RED
Taking into account Nick's concerns  - I'll add my voice to this - would be good - I'm using the ContextBrowser as well, lovely - long overdue... but of course you have to make that change to NR which will no doubt be wiped on an upgrade....

Julian Knight

unread,
Mar 11, 2017, 7:02:09 AM3/11/17
to Node-RED
Cool.

I tend to just set up some inject & debug flows. This is much more usable now we have the pop-out debug pane and formatted JSON. Agree though that this would be a really useful future enhancement for NR.

Peter Varadi

unread,
Oct 9, 2017, 2:02:00 PM10/9/17
to Node-RED
I am reviving this old thread to add my vote for a context browsing feature as an integral part of Node-RED.

Contexts in flow programming can be very useful but they are also dangerous, because they are hidden. We had a recent use case of lost productivity because of an orphaned context variable floating around (I admit, I don't know under which circumstances a context is cleared by Node-RED; maybe only upon restart?).  The risks of hidden contexts is also an argument that I get to hear against flow programming.

My strong recommendation to our flow developers is not to use contexts in flows because they will make troubleshooting deployments a nightmare months and years down the road. The ContextBrowser node is an excellent first step in the right direction but I see this issue as a hurdle to a more widespread commercial adoption of NodeRED. As such, a solution should be integral to Node-RED, rather than an optional npm download. I would be o.k. with having a limited context view at first if a comprehensive solution is too complex for now as Nick seems to indicate.

Peter

Nick O'Leary

unread,
Oct 10, 2017, 3:05:19 PM10/10/17
to Node-RED

Yes I agree this should be a core part of node-red. It just needs the time and resources to make it happen. I have more than enough work given the existing roadmap.

In absence of anyone stepping forward to help, it will have to wait it's turn!

Nick


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
Reply all
Reply to author
Forward
0 new messages