Custom SQL monitor
Custom SQL monitors are flexible monitors that let you express the SQL of your choice and automatically learn a time series around it. For example
- Ensure the accuracy of a key ML input numeric feature by creating a monitor to track the feature average over time
- Set up a monitor on average revenue grouped by geography to learn about sudden increases or drops for a specific region
- Detect unexpected patterns in the number of unique users created at the source level to prevent downstream impact
A custom SQL monitor detecting an anomaly in the average sales price for one region
Setting up a custom SQL monitor
-
Navigate to the table where you want to set up the monitor and click
Add Monitor
(you can only set up monitors on a data warehouse table. If you’re on a dbt model representation, click the link to the warehouse table to see the button) -
Select
Custom SQL
to start creating a custom SQL monitor -
Configure the monitor with the relevant settings
- SQL metric—any SQL expression that specifies the metric to track (e.g.,
avg(revenue)
). This must be an expression that results in a metric - Time partition—the time partition you want your data segmented by (e.g., creation_date)
- Days to delay—days to ignore if you have a delay in when you expect fresh data
- Sensitivity-see Configuring sensitivity
- Custom filter-specify filters using SQL
- SQL metric—any SQL expression that specifies the metric to track (e.g.,
-
Select a
variable
to segment by (optional). This will create multiple time series for each segment you select to include- To create a monitor for specific segments, toggle
Selected values
and select the desired values. - If you select
All values
, new values are automatically added.
Be cautious of including segments with only a few data points, as the model may not be able to confidently learn a reliable confidence interval for these segments, which can lead to many false/positive alerts
- To create a monitor for specific segments, toggle
-
Click
continue
to set up the monitor with the specified configurations
The monitor will appear in Synq shortly and can be found directly under the table you created it for and on the Health page
Custom monitors partition your data into time intervals based on the timestamp value of a selected column. It will construct a historical time series, with each time partition representing one data point. Monitor bootstraps on the past 30 days and then continue to query only the most recent time partition (to minimize query cost). This means the monitor can detect anomalies right after setting it up.
Resetting a monitor
If you want to rerun predictions for the past 30 days in case you made historical updates on the data, you can go to the monitor, click Settings
, and press Reset monitor
. This step is not reversible to only proceed if you’re certain you want to reset the monitor.