Monitors as Code
Manage Datafold monitors via version-controlled YAML for greater scalability, governance, and flexibility in code-based workflows.
INFO
Please contact support@datafold.com if you’d like to enable this feature for your organization.
This is particularly useful if any of the following are true:
- You have (or plan to have) 100s or 1000s of monitors
- Your team is accustomed to managing things in code
- Strict governance and change management are important to you
Getting started
INFO
This section describes how to get started with GitHub Actions, but the same concepts apply to other hosted version control platforms like GitLab and Bitbucket. Contact us if you need help getting started.
Set up version control integration
To start using monitors as code, you’ll need to decide which repository will contain your YAML configuration.
If you’ve already connected a repository to Datafold, you could use that. Or, follow the instructions here to connect a new repository.
Generate a Datafold API key
If you’ve already got a Datafold API key, use it. Otherwise, you can create a new one in the app by visiting Settings > Account and selecting Create API Key.
Create monitors config
In your chosen repository, create a new YAML file where you’ll define your monitors config.
For this example, we’ll name the file monitors.yaml
and place it in the root directory, but neither of these choices are hard requirements.
Leave the file blank for now—we’ll come back to it in a moment.
Add CI workflow
If you’re using GitHub Actions, create a new YAML file under .github/workflows/
using the following template. Be sure to tailor it to your particular setup:
Create a monitor
Now return to your YAML configuration file to add your first monitor. Reference the list of examples below and select one that makes sense for your organization.
Examples
INFO
These examples are intended to serve as inspiration and don’t demonstrate every possible configuration. Contact us if you have any questions.
Data Diff
Data Diff monitors detect differences between any two datasets, within or across databases.
Metric
Metric monitors identify anomalies in standard metrics like row count, freshness, and cardinality, or in any custom metric.
Supported metrics
For more details on supported metrics, see the docs for Metric monitors.
Table metrics:
- Freshness:
freshness
- Row Count:
row_count
Column metrics:
- Cardinality:
cardinality
- Uniqueness:
uniqueness
- Minimum:
minimum
- Maximum:
maximum
- Average:
average
- Median:
median
- Sum:
sum
- Standard Deviation:
std_dev
- Fill Rate:
fill_rate
Data Test
Data Test monitors validate your data with business rules and surface specific records that fail your tests.
Schema Change
Schema Change monitors detect when changes occur to a table’s schema.
FAQ
Need help?
If you have any questions about how to use monitors as code, please reach out to our team via Slack, in-app chat, or email us at support@datafold.com.