SERVERLESS_ALERT_HISTORY
functionsupportedUDFs, procedures, tasks, alerts, scriptingThis table function is used for querying the serverless alert usage history. The information returned by the function includes the alert name and credits consumed by the execution of each alert. Note This function is generally deprecated in favor of the ACCOUNT_USAGE.SERVERLESS_ALERT_HISTORY view, which provides a more complete data set and supports longer date ranges.
Syntax
supportedpartialnot supportednot scored
SERVERLESS_ALERT_HISTORY(
[ DATE_RANGE_START => <constant_expr> ]
[ , DATE_RANGE_END => <constant_expr> ]
[ , ALERT_NAME => '<string>' ] )
Parameters
| Name | Required | Description |
|---|---|---|
DATE_RANGE_START => constant_expr , DATE_RANGE_END => constant_expr | required | Date/time range of the usage window: If an end date is not specified, then CURRENT_DATE is used as the end of the range. If a start date is not specified, then the range starts 10 minutes prior to the start of DATE_RANGE_END (that is, the default is to show the previous 10 minutes of the usage history). For example, if DATE_RANGE_END is CURRENT_DATE, then the default DATE_RANGE_START is 11:50 PM on the previous day. |
ALERT_NAME => string | required | The name of the alert for which to retrieve usage history. Only the usage data for the specified alert is returned. Note that the alert name must be enclosed in single quotes. Also, if the alert name contains any spaces, mixed-case characters, or special characters, the name must be double-quoted within the single quotes (e.g. '"My Alert"' vs 'myalert'). |
Usage notes
- The table function returns results only for the ACCOUNTADMIN role or any role that has been explicitly granted the MONITOR USAGE global privilege. Note A role with the MONITOR USAGE privilege can view per-object credit usage, but not object names.
- When you call an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Snowflake Information Schema.
- The history is displayed in increments of 1 hour.
Output
The function returns the following columns: Column Name | Data Type | Description START_TIME | TIMESTAMP_LTZ | Start of the specified time range. END_TIME | TIMESTAMP_LTZ | End of the specified time range. ALERT_NAME | TEXT | Name of the alert. CREDITS_USED | TEXT | Number of credits billed for serverless alert usage during the START_TIME and END_TIME window.