ANOMALY_ INSIGHTS!RECALCULATE_ ANOMALIES¶
Recomputes the full history of an anomaly monitor and returns the new results.
Snowflake recomputes each monitor daily from the current state of your tags, but it can’t detect changes to which resources carry a tag. Call this method after you tag or untag resources and want the monitor’s history refreshed immediately.
Syntax¶
Arguments¶
'alias'Name of the monitor. The name isn’t case-sensitive.
Data type: VARCHAR
Output¶
Returns a table with one row per day in the monitor’s history, with the following columns:
| Column name | Data type | Description |
|---|---|---|
| USAGE_DATE | DATE | Day in UTC when the consumption occurred. |
| CONSUMPTION | NUMBER | Amount of consumption attributed to the monitor on this day. |
| FORECASTED_CONSUMPTION | NUMBER | Predicted consumption based on the anomaly-detecting algorithm. |
| CURRENCY_TYPE | VARCHAR | Unit of measure for the consumption, which corresponds to the monitor’s credit family. |
| LOWER_BOUND | NUMBER | Predicted lowest level of consumption based on the anomaly-detecting algorithm. Consumption levels below this value are considered anomalies. |
| UPPER_BOUND | NUMBER | Predicted highest level of consumption based on the anomaly-detecting algorithm. Consumption levels above this value are considered anomalies. |
| IS_ANOMALY | BOOLEAN | If TRUE, consumption fell outside the range defined by the lower and upper bounds, so Snowflake identified it as a cost anomaly. |
| ANOMALY_ID | VARCHAR | System-generated identifier for the anomaly. Empty when IS_ANOMALY is FALSE. |
| LAST_REFRESHED_AT | TIMESTAMP | Time when Snowflake last finished computing results for the monitor. This value is the same for every row. |
The method doesn’t accept a date range.
Access control requirements¶
Users with any of the following roles can call this method:
- ACCOUNTADMIN system role
- GLOBALORGADMIN system role
- SNOWFLAKE.APP_USAGE_ADMIN application role
- SNOWFLAKE.APP_USAGE_VIEWER application role
Usage notes¶
- The method fails if no monitor with the specified name exists in the account, or if the recomputation fails for any reason, such as a tag that can no longer be resolved.
- The call is synchronous and regenerates the full consumption time series and calculates any anomalies, so it takes longer to return than ANOMALY_INSIGHTS!GET_MONITOR_ANOMALIES.
- The recomputed results are saved, so later calls to ANOMALY_INSIGHTS!GET_MONITOR_ANOMALIES return the refreshed values.
- Recalculating a monitor doesn’t send notifications.
Example¶
Recompute the results for the monitor named Eng-Platform: