查看指标数据

您可以通过以下方式查看指标数据以供分析:

  • Use Snowsight or Grafana.
  • 执行事件表上的 SELECT 命令。

Note

Before you can begin using metrics data, you must enable telemetry data collection.

Visualize on Snowsight

You can use Snowsight to view metrics data captured in the event table.

  1. Sign in to Snowsight.
  2. In the navigation menu, select Monitoring » Query History.
  3. In the Query History page, select the query for which you want to view metrics data.
  4. Select the Query Telemetry tab.
  5. Select the span for which you want to view data, then select the Related Metrics tab.
  6. 查看查询过程中的时间序列指标和随时间变化的指标。

在 Grafana 上进行可视化

您还可以使用免费的合作伙伴工具(例如 Grafana Cloud)对指标数据进行可视化。

For Snowflake dashboard templates and installation instructions for Grafana Cloud, see Snowflake Telemetry Dashboard Templates (https://github.com/snowflakedb/snowflake-telemetry-dashboard-templates).

使用 SELECT 语句执行查询

When querying for data, you can select attribute values within a column by using bracket notation, as in the following form:

Code in the following example queries the preceding table with the intention of isolating data related to the DIGITS_OF_NUMBER function.

SET EVENT_TABLE_NAME='my_db.public.my_events';

SELECT TIMESTAMP, RESOURCE_ATTRIBUTES['snow.executable.name'] AS FUNCTION_NAME, RECORD['METRIC']['NAME']AS METRIC_NAME, VALUE
FROM EVENT_TABLE_NAME
WHERE
  RESOURCE_ATTRIBUTES['snow.query.id']  = <INSERT YOUR QUERY ID>
  AND RECORD_TYPE = 'METRIC'
ORDER BY TIMESTAMP DESC;