Should debug nodes be capable of passing the message forwards?

In a recent thread @TotallyInformation pointed out that a node having two output wires results in Node-red cloning the entire message object.

If this is the case, how much extra processing / memory does this consume?

Would it be more economical if the debug node had an output and could optionally be inserted in a wire as the junction node can?

image
image

As well as (potentially) being more efficient, this offers less visual clutter in flow diagrams.

A new right click, insert option to insert a debug node (initially with label hidden) would speed up inserting debugs and complement the existing right click, delete & reconnect to delete.

Note that the debug node has the turn on/off switch - pass the message through regardless of this and the normal enable/disable config option - block the message if it disabled.

1 Like

A pass through debug has been on my wish list for some time (I've commented on this several times e.g: Custom node appearance and event handlers. Proof on concept: Inline Gauge - #12 by Steve-Mcl) but there was push back due to loss of button. Personally I think it's time for a rethink on input or button/output or button exclusivity.

A promising new node log-io had this inline mode ([Announce] node-red-log-io - #21 by Steve-Mcl) but the author removed it as they were unsure of its value. I explained how it is a benefit for larger payloads (to avoid cloning) and the author is considering adding it back in.

5 Likes

Of course it's been considered before! Thanks for the link.

I was considering the visual provision of both switch and output connector (nexus?).
It certainly does not look very elegant for the wire to visibly run through the switch, though it does perhaps emphasise that this nexus is wired up.

An alternative i considered was for a new node type, basically the same appearance as a junction except for the colour (just as all nodes have their characteristic colour).
Either have the colour reflect the debug/passthrough settings or use a normal status indicator below the node.

We could call it Debug 2. Or Debug 2.0 :grinning:

To be honest, I'd settle for an intermediate where the debug node gets an extra flag. If set, it looses the switch and gains an output. I think this would cover the vast majority of cases since you can already effectively turn off output by not selecting the option in the settings.

That would surely be a quick and easy change and would be fully backwards compatible as the new setting would not be the default.

2 Likes

Mostly I agree as it's visually much better... (hate the button plus link on top... uurgh) - but then it would be always on sending to the log with no way to turn off apart from unwiring.

I also like the idea of a new type of debug node - as per @jbudd - junction like node - (lets call it a test point :slight_smile: ) - it could have an option to only write to the debug log when hovered over... (like a probe in an elec circuit).

1 Like

Regardless of any performance gains, I would always use this "test point" in preference to normal debug nodes just for the sake of visual declutter.

Only output while hovered though, seems like a gimmick.

But while on the topic of scope creep, how about a built-in link out node in the config, allowing customised debug handling flows?

but a useful one - I usually run with most of my debug nodes turned off - and only turn them on to see when I need to.

Ok but how do you hover over one node and click to inject at the same time?

I'm not saying hover should be the only mode of operation - click on and click off also a totally valid configuration. But yeah - most of the work I do does not require many inject nodes - lots of streams of live data instead.

Also click on/off would require saving of state - so would trigger the deploy button (may not need to deploy but) - whereas hover would be stateless and not flag a deploy.

Not the case I think Dave. Simply de-select the option. Requires a re-deploy of course.

PS: Actually, it would be perfectly possible to make those flags immediately tell the runtime to stop output just like the button does.

Yes - lots of clicks :wink:

This topic has come up many times. I do agree an improved debug node - of some sort - would be beneficial. Being able to 'attach' a debug probe at any point in the flow. I think it may be some new UX capability, rather than the "normal" node UX.

The current model of debug node doesn't avoid the cloning overhead; the button on the node just mutes it rather than disables it, so the node still has to receive its copy of the message even if it then does nothing with it.

More clicks but still a major improvement with minimal change to the debug node. Sometimes something is better than nothing. :slight_smile:

Indeed - and I think I did in fact code this up once upon a time to try it... but hey - went the way of many branches :wink:

Another goal is being a to "turn on" debug at any point in the flow without having to litter them with debug nodes.

All for making a smoother developer experience.

1 Like

I think this would better fit as a right click option - "Toggle button".
Useful for other nodes which have a button (switch?) too.

ATM clicking on the debug node button marks the node as changed, but the processing changes without a deploy. Toggle button should be the same.

1 Like

Not getting your drift with that ? Why does it need to be right click ? (bad for touch screen) . Why not just click on/off like existing button... just in this (test point) case the whole (small dot) is the switch/hover target.

Crazy thought, how about making wires that send to debug when highlighted?

If I click a wire while editing and it's currently "live" with 1000 messages a second the editor would get swamped... and wires don't have properties so it would would a global setting... all wires or no wires .

You could disable and enable by the menu, action or editor button (enable wire debug)