Area: Observability
Sub-Area: Quality Monitoring
Applies to: Cloud
Issue
You want to track data quality over time, see how often assertions pass or fail, and get alerted when quality drops.
You Might Be Asking
- How do I track data quality over time?
- Can I see historical assertion pass rates?
- How do I get alerted when assertions fail?
Solution
Assertions, monitors, subscriptions and the Data Health Dashboard are DataHub Cloud features. Use the built-in features first. Use GraphQL only when you need the raw results.
1. Find failing and flaky assertions in the Data Health Dashboard
The Data Health Dashboard shows failure trends without any code.
- In the sidebar, open Observe and then the Data Health Dashboard.
- Open the Assertions tab. It has By Assertion and By Table views.
- In By Assertion, set a time range such as Last 7 Days and set Results to At least one failure.
This shows which assertions failed and how often they fail compared with how often they run. That helps you find flaky checks. The dashboard also has an Incidents tab. The By Table and Incidents tabs apply your global View.
2. Get alerts when assertions fail
DataHub Cloud sends assertion notifications from the platform. You do not need a DataHub Actions pipeline. Supported channels are Slack, Microsoft Teams and email. See Subscriptions and notifications.
- For a whole dataset: open the dataset, click Subscribe (Subscribe Me, or Manage for groups), and enable Assertion status notifications. The options are Any assertion fails, Any assertion errors, Any assertion passes and Any assertion recovers.
- For one assertion: click the bell on the assertion ("Subscribe to assertion...") and pick This assertion fails, errors, passes or recovers. See Subscribing to assertions.
- Personal channels: go to Settings > My Notifications, enable each channel and enter your handle.
Email and Teams notifications are turned on per instance on the server side. If they are not available, contact DataHub Support.
There is no quality_alert action in DataHub Actions, so do not use one.
3. Reduce false alarms on anomaly-detection assertions
On the assertion page (or its Settings tab), use Tune Predictions. You can add Exclusion Windows for bad historical periods, lower the Sensitivity, or adjust the training data lookback window. If a jump is the new baseline, mark the run Train as New Normal. That excludes all earlier data from training. See Anomaly detection.
4. Pull run results with GraphQL
Call https://<your-account>.acryl.io/api/graphql with a personal access token as a Bearer token.
Pass or fail is in result.type, not in status. AssertionRunStatus has one value, COMPLETE, which only means the run finished. result.type is one of INIT, SUCCESS, FAILURE or ERROR.
Assertion.runEvents takes status, startTimeMillis, endTimeMillis, filter and limit. It has no start or count. Without a time range it returns the most recent events up to limit. Select the events as runEvents { runEvents { ... } }. The outer object also returns the counts total, succeeded, failed, errored and initializing.
Dataset.assertions takes start, count and includeSoftDeleted. It returns an object with start, count, total and assertions. Select the inner assertions { ... } list before any assertion field such as urn. See the GraphQL Assertion reference.
query getDatasetAssertionResults($urn: String!, $since: Long) {
dataset(urn: $urn) {
assertions(start: 0, count: 20) {
total
assertions {
urn
runEvents(startTimeMillis: $since, limit: 100) {
total
succeeded
failed
errored
runEvents {
result {
type
actualAggValue
externalUrl
}
}
}
}
}
}
}
To get a pass rate, use the succeeded, failed and errored counts. Do not count runs by status, because every finished run is COMPLETE and the rate would always read 100 percent. For more API examples, see the Assertions API and Python SDK.
Additional Notes
How often results appear depends on the assertion type and platform:
- Assertions in active-query mode run on a schedule you set. They work only on Snowflake, Redshift, BigQuery and Databricks.
- On other platforms, Freshness, Volume and Column Metric assertions use ingested metadata (operations and dataset profiles). Results refresh only as often as that metadata is ingested.
- Schema assertions are evaluated whenever DataHub detects a schema change in the ingested schema.
- You can also report results from third-party tools into DataHub, such as dbt test and Great Expectations.
Related Documentation
- Assertions
- Data Health Dashboard
- Anomaly detection
- Subscriptions and notifications
- Subscribing to assertions
- Assertions API and Python SDK
- GraphQL Assertion reference
Tags: data-quality, monitoring, trending, assertions, quality-score, observability, sla, health-checks, metrics