Tray has a mechanism to allow you to send alerts when a workflow errors. Errors can be sent to another workflow and that workflow is responsible for handling the alerting. This means that you can use all of the functionality of a Tray workflow to route your errors wherever you like. For example, you can send error reports to a dedicated slack channel or use the HTTP connector to pass on any errors to your monitoring system of choice.
There are two steps to setting up error alerting in Tray:
- Create an alerting workflow using the Alerting Trigger
- Configure your workflows to send their errors to your alerting workflow
You can use the same alerting workflow to handle the errors from multiple workflows. For example, you might set up your alerting workflow to send you an email with details of each error it receives. You can set all of your existing workflows to report their errors in this way.
Creating an alerting workflow
Create a new workflow and select the Alerting Trigger as its trigger.
This is a special kind of trigger that can accept alerting payloads from other workflows. Alerting payloads are in the following format:
|workflow_uuid||The UUID of the workflow which sent the error|
|workflow_url||The URL of the workflow which sent the error|
|workflow_title||The title of the workflow which sent the error|
The name of the specific step which was the cause of the error.
Note that the is not the user-configured name but the unique name given by Tray
|step_log_url||This URL can be used to go directly to the point in the logs at which this error occurred|
The type of connector (and version) that caused the error
|message||The internal Tray-generated error message|
|created||A timestamp of when the error occurred|
Your alerting workflow can make use of these fields to provide useful information for debugging. The payload includes the uuid, url, and title of the workflow which has errored as well as the specific step name and a link to the step in logs. This link to the logs is useful for debugging the cause of the error and will.
Workflows with an alerting trigger behave just like any other workflow. You can build any logic you like into your workflow to handle the incoming errors.
Configuring your workflow to send errors to your alerting workflow
Click on the cog in the top left corner of the builder. This will open the Workflow Settings panel. From here you can set the alerting workflow which will handle the errors from this workflow. Note that only workflows with an Alerting Trigger will appear in this list.
Errors are only sent to alerting workflows once all retries of a workflow have failed.
Multiple workflows can use the same Alerting Workflow but each workflow can only send its errors to a single Alerting Workflow.
Here's a short video tutorial on how to use alerting in practice.