Can I get node ancestors?

Hi all, Im playing around, trying out functionality. Is there a way to access a nodes ancestors? Specifically the last node that triggered the current node?
Generally the node trail from initation?

thanks in advance

Welcome to the forum @dvsctt

Do you mean that you want to know which node an incoming message came from? Often the topic is used for things like that. Set the topic differently in the multiple paths to the node and then test it where you need to know.

Yes I want to know where a node came from and the path it took (eg ordered list/array of nodes).

I dont want to write an update between every node to set a topic of the name etc of the previous node just to capture it. I had thought that internally as a message moves through a path of nodes, the history or at least the previous node details would be available.

Use case is some overarching logging and monitoring of the flows themselves for flow analytics.

New to this tool and still investigating how it all fits together. Im not sure if thats what you mean by using the topic (manual update) as all my debugging of various message states etc hasnt revealed a system updated path.

thanks

I'm sure that one of @BartButenaers contrib nodes fulfilled this.

See GitHub - bartbutenaers/node-red-contrib-msg-profiler: A Node-RED node to execute time profiling (and tracing) of a message through a flow

2 Likes

@dvsctt no, that information is not directly available.

An alternative approach is the metrics logging type - this emits events for every message send/receive event in the runtime.

You have to enable it via your settings file - but you'd more likely add a custom logger that captures just the metrics events rather than flood the normal log output. Details in the docs:

https://nodered.org/docs/user-guide/runtime/logging#metrics

thanks, I'm looking at both.