App Error Reporting and Observability
This laboratory focuses on configuring Retool to forward Application Errors to Datadog as well as using the new Retool Error Event to trigger a workflow to other third-party providers.
Requirements
To configure observability you will need:
- Datadog account or Trial account
- Datadog API Key
- Retool Enterprise plan
- Download / Import simple error application
- Configure Retool Database with a simple table / dataset
Steps
Setup Database Table
The example requires a table with data that can be accessed. Select here to download.
- Once the example is downloaded, go to Retool Home > Database > Import from CSV.
- Select
vendors.csv
and specify the table name as vendors.
Import Error Application
To demonstrate the use of Application Error Reporting, a simple application is employed that has an incorrect SQL statement. Select here to download.
- Once the example is downloaded, go to Retool Home > Apps > Create > From JSON/ZIP.
- Select Upload a file and specify the downloaded
ErrorApp.json
. - Select Create app.
Configure API Key in Datadog
For Retool to be able to send Datadog events, it is necessary to create an API key in the Datadog account.
- Select your user profile > Organization Settings > API Keys
- Select New Key
- Enter a key name, for example
Retool-Datadog-API-Key
.
- Select Create Key.
- A dialog showing the
API Key
,Name
,Key ID
, andRemote Config
is displayed.
- Copy the
API Key
so that we can configure Retool App Error monitoring.
Enable Observability / App Error Monitoring
Within Retool, App Error monitoring is enabled under Settings > Observability.
- Enable Datadog.
- This will open the Datadog integration dialog.
- Enter the
API Key
copied from Datadog. - Change the Datadog site to match, for example
US5
, what is in the URL for your Datadog URL. The following URL shows the site:
https://us5.datadoghq.com/logs...
- Select Save to save the configuration.
- Select
Ping
to confirm successful connection to Datadog. It will display a green check. - Exit the window by selecting Cancel. Datadog will now display as active.
Trigger errors
Next we will trigger errors using the ErrorApp.
- Go to Retool Home > Apps > ErrorApp.
- If the app displays in Editor Mode, select the Navbar Preview. This is required in order to forward errors to Datadog. When apps are in Edit mode, errors are visible in Debug.
- Click on the
InvokeError
button several times. - An error will display in the bottom corner:
query1 : column "ids" does not exist
The cause for this error is that the SQL query, query1
is asking for a columns ids
that doesn't exist.
Examine Datadog console
Datadog should receive these errors and display under Logs > Log Explorer.
- Datadog will display number of logs found and show errors in the dashboard.
- Selecting errors from Service
retool-error-monitor
will allow the user to dive into the message.
The following arcade shows the display and error details.
Error Forwarding to Third Party providers
Currently Retool supports Datadog, Sentry and third-party integration via Retool Events and Retool Workflows. The following steps will cover this option, using Datadog again as the destination provider.
Create Retool configuration variable
This workflow will leverage the Datadog Logging API. In order to post errors, we will need to configure the Datadog API Key in a Retool Configuration Variable marked as secret.
- Select Settings > Configuration variables > Create new
- Specify a configuration variable name of
datadog_api_key
, description is the same,Mark variable as secret
is enabled, and inValues
specify the Datadog API Key. - Select Save changes.
Create an Error Workflow
To start, an error workflow needs to be created. Download the sample here to get started.
- Select Retool Home > Workflows > Create new > From JSON
- Select
Datadog-WF.json
- Configure the
pushErrorToDatadog
block to match your Datadog configuration. Specifically look at the URL for the POST.
Datadog has different locations that it runs and the API endpoints for these locations can cause this value to shift. Check out the following URL and specify the Datadog Site.
https://docs.datadoghq.com/api/latest/logs/#send-logs
The following video shows how the Datadog sites alter the URL and thus you need to select the proper one for integration.
- Once you have edited the workflow, select Deploy and provide a description message and select Deploy.
Enable Events / App Error
Now that we have a workflow that can process errors, we need to connect Retool Events to the workflow.
- Select Settings > Retool Events > Retool App Errors > Add a workflow and select
Datadog-WF
.
Trigger Errors
With the Retool App Errors forwarded to the Retool Workflow, we can now test the forwarding of events.
- Select Retool Home > Apps and open the
ErrorApp
. - Click on the InvokeError button when running in preview mode.
- Select Retool Home > Workflows and open
Datadog-WF
. - Select Run history and examine the latest workflow runs. You should them executed based on the number of times you clicked the button. It should display similar to what is shown in the following image.