使用 Snowsight 处理成本异常

本主题介绍如何使用 Snowsight 来识别和调查成本异常,即某个账户或组织的每日消耗高于或低于当天的预期消耗范围的情况。本文还说明如何使用 Snowsight 配置通知,以便在发生成本异常时向特定用户发送电子邮件。

有关成本异常的概述,请参阅 成本异常简介

使用 Snowsight 配置通知

当 Snowflake 发现成本异常时,会向一个电子邮件地址列表发送通知。在决定哪些用户将收到费用异常通知时,请注意,电子邮件通知可能包含有关账户支出金额的详细信息。

每个账户都可以有一个账户内账户级别异常的通知列表。您还可以为组织定义单独的通知列表,以控制在组织出现异常时通知哪些用户。

每个电子邮件地址都必须 经过用户验证

您可以使用组电子邮件地址(例如通讯组列表)来接收通知,但此电子邮件地址必须进行验证。在将组电子邮件地址添加到通知列表之前,您可能需要使用该组电子邮件地址创建一个新的 Snowflake 用户,以便对其进行验证。

备注

通过 Snowflake 的 Amazon Web Services (AWS) 部署,使用 AWS Simple Email Service (SES) 处理电子邮件通知。使用 AWS 发送的电子邮件内容可由 Snowflake 保留最多三十天,以便管理消息的传递。此期限过后,消息内容将会删除。

要添加在发生成本异常时接收通知的电子邮件地址,请完成以下步骤:

  1. Sign in to Snowsight as a user with the required privileges.

  2. 在导航菜单中选择 Admin » Cost management,然后选择 Anomalies

  3. 选择 Notifications

  4. 要指定哪些用户会收到有关 账户级别异常 的通知,请执行以下操作:

    1. Notify for account anomalies 字段中,输入您希望在发生成本异常时联系的 Snowflake 用户的电子邮件地址。

    2. Enter

    3. 对其他用户重复此操作。

  5. 要指定哪些用户收到 组织级异常 通知,请执行以下操作:

    1. Notify for organization anomalies 字段中,输入您希望在发生成本异常时联系的 Snowflake 用户的电子邮件地址。

    2. Enter

    3. 对其他用户重复此操作。

  6. 选择 Save changes

识别和调查 Snowsight 中的成本异常

第 1 步:识别成本异常

  1. Sign in to Snowsight as a user with the required privileges.

  2. 在导航菜单中选择 Admin » Cost management,然后选择 Anomalies

  3. 使用筛选器选择时间范围和账户。如需识别 组织级别的异常,请选择 All accounts

  4. 执行下列操作之一:

    1. 使用图表可视化跟踪实际消耗与预期消耗范围随时间的变化。实际消耗超出或低于预期范围的成本异常会在图表中直观显示出来。

    2. 使用该表查看时间范围内所有成本异常的列表。并根据需要排序。

第 2 步:调查成本异常

After identifying a cost anomaly, you can investigate it using the side panel or by using Cortex Code to ask natural-language questions.

Investigate using the side panel

  1. 通过单击图表中的指标或在表格中选择一行来选择成本异常。侧面板打开。

  2. If you are investigating an account-level anomaly (you selected a specific account in the filter), you can use the side panel to drill down into the following:

    • Use the Top consumption drivers section to investigate hourly consumption within the account. You can view consumption for all service types or you can focus on the services that consumed the most credits during the day.

    • Use the Top warehouses section to identify the warehouses within the account that had the greatest absolute change in consumption.

    • If you are investigating anomalies in the account that you are currently signed in to, use the Top queries section to identify the most expensive queries in the warehouse that had the greatest change in consumption. This might not show the most expensive query in the account because it focuses on queries in a specific warehouse (the one with the greatest change in consumption).

    • Drill down into the most expensive queries by selecting the Open in Worksheet icon that is located near the Query ID. A worksheet opens that shows the query that was executed.

  3. If you are investigating an organization-level anomaly (you selected All Accounts in the filter), you can use the side panel to drill down into the following:

    • Use the Top accounts section to identify the accounts that had the greatest absolute change in consumption.

    • Use the Top warehouses section to drill down into the account with the greatest change in consumption. You can identify the warehouses within the account that had the greatest change in consumption.

    This might not show the warehouse with the greatest change within the entire organization because it focuses on warehouses in a specific account (the one with the greatest change in consumption). To programmatically retrieve the top warehouses in a different account or within the organization, see Warehouse-level consumption.

小技巧

If the Anomalies tab does not provide the consumption data you need to identify the root cause of the cost anomaly, you can select the Consumption tab for further investigation.

Investigate with Cortex Code

Cortex Code is an AI-driven intelligent agent integrated into the Snowflake platform. You can use Cortex Code to investigate cost anomalies by highlighting a section of the consumption chart and asking natural-language questions.

备注

First-time users: When you first access the Anomalies tab, you might see an introductory prompt highlighting the Snap and Ask feature. This prompt appears near the consumption chart and introduces the Add to Chat and Explain quick actions. Select either action to begin using Cortex Code for cost investigation.

Prerequisites

Before you can use Cortex Code to investigate cost anomalies, you must be granted the following privileges:

Investigate a cost anomaly with Cortex Code

To investigate a cost anomaly with Cortex Code, do the following:

  1. Identify and highlight activity in the consumption chart that you want to investigate, such as a spike in compute costs.

    The Add to Chat and Explain quick actions appear.

  2. Select one of the following quick actions:

    • Add to Chat: Start a Cortex Code chat where you can enter prompts and interact with Cortex Code.

    • Explain: Cortex Code will analyze the highlighted area of the chart and return an analysis.

  3. Cortex Code analyzes the cost activity for the highlighted area and reports its findings. It might ask you to run SQL statements to gather more information about the anomaly. For example, if you ask about a cost spike, it might generate a SQL statement that identifies the warehouses, queries, or users that contributed to the increase.

Example prompts

The following example prompts cover different types of analysis that Cortex Code supports for cost anomalies:

Use case

Example prompt

Gather general information about a cost change

What changed in this highlighted window?

Determine the cause of a cost spike

Why did this cost spike occur?

Identify cost drivers

Which top warehouses contributed the most to this increase?

Get recommendations to reduce costs

What can I do to reduce these costs?

Investigate specific cost categories

What queries caused this compute cost increase?

For more information, see Cortex Code.