The Debug Node allows inspection of the current payload at any point during a workflow. It is extremely useful when initially constructing a workflow, to make sure that all the various components are acting on the payload as expected.
The Debug Node is very simple to configure - there are only two sections, and both are optional.
NOTE the use of a Debug Node does not alter or mutate your workflow payload in any way. The presence or absence of a debug node will not alter how your workflow runs or the result.
The Debug Node takes an optional message (a string template) to include in the debug messages that get displayed. In the above example, the message is “Before Mutate”.
The node also allows for only printing a single property from the payload, as defined by a payload path. If the property is defined in the configuration, and that property does not exist on the payload, the debug output will print
Whenever a workflow runs, and in the process that run passes through one or more Debug Nodes, the workflow run will be visualized two different ways.
Every time a Debug Node is hit, the timestamp and payload value will be written as a new message in the Debug tab. New messages appear at the top of the list. If multiple Debug Nodes are hit as part of a single workflow run, each Debug Node will get an entry in the panel; this can be helpful in determining how your payload changes over the course of a run.
To view that payload’s path through the workflow run, hover your mouse over the debug message. You will see the nodes that were part of the run highlight, and the Debug Node that generated the message will be called out.
Optionally, you may also enable the Live Debug Stream by clicking the button in the top right corner of the workflow stage. When live streaming is enabled, you will see workflow runs highlight in real time as they fire.
NOTE should multiple workflow runs occur per second, some of the runs may not be visualized on the stage. Also, if you have unsaved changes in your workflow, live streams will automatically be disabled until the changes are saved.
The debug panel allows you to pause incoming debug messages, or clear the currently displayed debug messages. It also has two more substantial configuration options:
- Expand all properties: By default, the only automatically expanded property in a debug message is the
dataproperty. If this box is checked, all properties will start out as expanded in a message (they can still be manually expanded/collapsed after the fact).
- Enable messages from custom nodes: By default, debug nodes within a custom node are ignored. However, if this box is checked, any debug messages from inside custom nodes in the current workflow will be displayed in the debug log alongside debug messages from the workflow itself.
If the workflow is an application workflow or experience workflow, debug node output is generated for any runs of the workflow whenever you are looking at the workflow. For edge workflows, however, by default no debug output is generated. When you want debug output for an edge workflow, you must first select an Edge Compute device that the workflow is deployed and running on. At that point, Losant will tell the Edge Agent on that device to start debugging that workflow, and the Edge Agent will start reporting debugging information.
Of course, for an edge device to report workflow debug information, it must be connected to the internet and Losant. If an edge device is not online or connected, no debug information will appear even if the device is selected. In addition, debug messages from an edge device are also batched and throttled - a batch of debug messages will be sent up to Losant no more than once per second, with no more than five debug messages. So if a workflow is running quite frequently on an edge device, you might not see all the debug messages in the debug log.
While the Debug Node itself does not have any built in throttles or limits, the debug panel and live stream do. The debug stream will display up to 10 messages per half second - if your workflow is generating more than that, some debug messages may be dropped. If that does happen, a throttled message will appear in the debug panel, like so: