Area: Observability Issues
Sub-Area: Smart Assertions / Anomaly Detection
Applies to: Cloud
Issue
You enabled Anomaly Detection (formerly called Smart Assertions) on Volume assertions. The predicted band is shifted away from your real row counts, and the assertions raise many false positive anomalies. The model does not correct itself on its own. When false positives cover many assertions and long time ranges, marking each point as normal in the UI one by one takes too long.
You Might Be Asking
- Why is my Smart Volume Assertion forecast shifted above or below my real data?
- How much history does Anomaly Detection need before it alerts?
- Does retraining delete my historical data?
- Can I mark hundreds of false positives as normal at once, without clicking each one?
- After I mark anomalies as normal, when does the model retrain?
Cause
A new Anomaly Detection assertion collects 14 days of history before it starts alerting. If that early history contains unrepresentative points, such as a one-off spike, the model learns a poor baseline.
When an Anomaly Detection assertion fails, DataHub records the failure as an anomaly. The model ignores data points flagged as anomalies when it trains. So a run of false positives keeps those real data points out of the training set, and the forecast band stays misaligned until you mark the points as normal or adjust the training data.
Solution
- Check how much history the assertion has.
A new Anomaly Detection assertion evaluates on its schedule for 14 days and records results, but does not raise failures during that time. To skip the wait, you can turn on Backfill Assertion History when you create the assertion. Backfill is in Private Beta. It works only for Volume and Column Metric assertions that use time-series bucketing, on Snowflake, Redshift, BigQuery and Databricks. See How much history does Anomaly Detection need? and Backfill Assertion History.
- Remove bad training data in the Tune Predictions dialog.
Open the assertion and click Tune Predictions. Drag your cursor across a range on the chart. A menu appears with two options:
- Exclude Metrics adds a training data exclusion window for that range. The model ignores the range when it trains. The data itself stays in DataHub, and you can remove the window later from the exclusion window list in the same dialog.
- Include Metrics marks every data point in the range as not an anomaly, so the model trains on those points again. DataHub asks you to confirm with a Bulk-Remove Anomalies? prompt.
You can also change the sensitivity and the training data lookback window in this dialog. The model trains on data inside the lookback window, minus exclusion windows and points flagged as anomalies. See Tuning.
- Mark single false positives as normal.
On the assertion results timeline, hover over a failed result and select Mark as Normal. If a sudden change is the new normal going forward, select Train as new Normal instead. That adds an exclusion window for all data before that run. See Anomaly Feedback.
- Bulk mark false positives as normal with GraphQL.
To fix many assertions without the UI, call the bulkUpdateAnomalies mutation. This is the same call the Include Metrics action makes. It takes:
-
monitorUrn: the URN of the monitor that evaluates the assertion (required) -
assertionUrn: the assertion URN -
startTimeMillisandendTimeMillis: the time range, in Unix milliseconds -
state:REJECTEDmarks the points as false positives (not anomalies).CONFIRMEDmarks them as real anomalies. These are the only two values.
Don't build the monitor URN by hand. Monitors created in the UI get a random ID, not the assertion URN. Look it up from the assertion instead. To list every assertion on a dataset with its monitor:
query {
dataset(urn: "urn:li:dataset:(urn:li:dataPlatform:snowflake,db.schema.table,PROD)") {
assertions(start: 0, count: 1000) {
assertions {
urn
monitor {
urn
}
}
}
}
}
For one assertion, use assertion(urn: "urn:li:assertion:<id>") { urn monitor { urn } }.
Then send the mutation for each assertion to https://<your-account>.acryl.io/api/graphql, with the header Authorization: Bearer <your-access-token>:
{
"query": "mutation BulkRejectAnomalies($input: BulkUpdateAnomaliesInput!) { bulkUpdateAnomalies(input: $input) { state timestampMillis } }",
"variables": {
"input": {
"monitorUrn": "<monitor urn from the query above>",
"assertionUrn": "urn:li:assertion:<id>",
"startTimeMillis": 1767225600000,
"endTimeMillis": 1769904000000,
"state": "REJECTED"
}
}
}
The mutation writes feedback for every assertion run in the range that does not already have that state. It returns the feedback events it created, so an empty list means nothing changed. See the GraphQL API getting started guide for the endpoint and tokens.
- Check the new predictions.
You don't wait for a scheduled training cycle. After Include Metrics, Mark as Normal, or a bulkUpdateAnomalies call, DataHub clears the current predictions and starts a retrain of that monitor right away. In the Tune Predictions dialog you see "Regenerating future predictions..." until the new band appears. Retraining does not delete any stored metrics. Watch the next scheduled runs to confirm the assertion passes on normal data.