ANOMALY_ INSIGHTS!ADHOC_ CALCULATE_ ANOMALIES_ FROM_ CONFIG¶
Runs cost anomaly detection against a configuration without creating an anomaly monitor. Use this method to test a combination of tags and service types before you save the combination as a monitor.
Syntax¶
Arguments¶
configConfiguration that defines the scope to test. It uses the same keys as the configuration of a saved monitor, but it names each tag directly with the
tagDatabase,tagSchema,tagName, andtagValueskeys instead of taking a tag reference. For more information, see Monitor configuration.Data type: VARIANT
'start_date'Specifies the beginning of the time period for which consumption data is returned.
Data type: DATE
'end_date'Specifies the end of the time period for which consumption data is returned.
Data type: DATE
Output¶
Returns a table with one row per day in the time period, 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. |
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
Unlike ANOMALY_INSIGHTS!CREATE_MONITOR, this method doesn’t require the APPLYBUDGET privilege on the
tags in the configuration.
Usage notes¶
- This method names each tag directly rather than taking a tag reference, so you don’t call SYSTEM$REFERENCE to build the configuration. Nothing is saved and the configuration runs only one time, so no reference needs to be resolved.
- The tag-name shape is the same one Snowflake returns when you read a configuration back, so you can pass a saved monitor’s configuration straight to this method.
- The configuration must include at least one tag in
resource_tags.tagsor at least one entry inservice_types. The method fails if it contains neither. - The results aren’t saved. To save a configuration as a monitor, use ANOMALY_INSIGHTS!CREATE_MONITOR, which takes tag references instead of tag names.
- The method regenerates the full consumption time series and calculates any anomalies, so it takes longer to return than ANOMALY_INSIGHTS!GET_MONITOR_ANOMALIES.
Example¶
Test a configuration that tracks credits consumed by resources tagged with the department finance, along with all serverless task
consumption in the account, for consumption between January 1, 2026, and March 31, 2026: