收集指标数据
您可以使用 Snowflake 生成的 CPU 以及内存指标更好地理解存储过程和 UDF 资源消耗。利用这些信息,您可以对错误和性能问题进行故障排除。指标数据存储在您的账户事件表中。
After you’ve collected data in the event table, you can access the data for analysis via SQL or in Snowsight. For more information, see Viewing metrics data.
Note
Before you can collect metrics data, you must enable telemetry data collection. You don’t need to add code to emit metrics data. Snowflake generates the data and collects it in an event table.
指标数据级别
您可以通过设置指标级别来指定是否收集事件表中的指标数据。确保设置级别以便收集数据。
For more information, see Setting levels for logging, metrics, and tracing.
When you’ve collected data, you can view metric data by using a graphical tool or by querying the event table with SQL.
支持的语言
You can collect metrics from code written in the following languages, including when handler code is written with Snowpark APIs.
| Language / Type | Java | Python | JavaScript | Scala | Snowflake Scripting |
|---|---|---|---|---|---|
| Stored procedure handler | ✔ | ✔ | |||
| Streamlit app | ✔ | ✔ | |||
| UDF handler (scalar function) | ✔ | ✔ | |||
| UDTF handler (table function) | ✔ | ✔ |
来自处理程序代码的指标数据
当您的代码执行时,Snowflake 会自动捕获指标数据。您不需要对处理程序代码进行任何更改。
For more information, see Emitting metrics data from handler code
查看指标数据
You can view collected metrics data either through Snowsight or by querying the event table where data is stored. For more information, see Viewing metrics data.