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

SNOWFLAKE.LOCAL.ANOMALY_INSIGHTS!RECALCULATE_ANOMALIES(
  '<alias>' )

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 nameData typeDescription
USAGE_DATEDATEDay in UTC when the consumption occurred.
CONSUMPTIONNUMBERAmount of consumption attributed to the monitor on this day.
FORECASTED_CONSUMPTIONNUMBERPredicted consumption based on the anomaly-detecting algorithm.
CURRENCY_TYPEVARCHARUnit of measure for the consumption, which corresponds to the monitor’s credit family.
LOWER_BOUNDNUMBERPredicted lowest level of consumption based on the anomaly-detecting algorithm. Consumption levels below this value are considered anomalies.
UPPER_BOUNDNUMBERPredicted highest level of consumption based on the anomaly-detecting algorithm. Consumption levels above this value are considered anomalies.
IS_ANOMALYBOOLEANIf TRUE, consumption fell outside the range defined by the lower and upper bounds, so Snowflake identified it as a cost anomaly.
ANOMALY_IDVARCHARSystem-generated identifier for the anomaly. Empty when IS_ANOMALY is FALSE.
LAST_REFRESHED_ATTIMESTAMPTime 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:

CALL SNOWFLAKE.LOCAL.ANOMALY_INSIGHTS!RECALCULATE_ANOMALIES('Eng-Platform');