事件表列
An event table is a special kind of database table with a predefined set of columns. The table’s structure is designed to support the data model for OpenTelemetry (https://opentelemetry.io/), a framework for handling telemetry data.
For more information about working with event tables, see Working with event tables.
事件表列
事件表包含以下列:
| Column | Data Type | Description |
|---|---|---|
| TIMESTAMP | TIMESTAMP_NTZ | The UTC timestamp when an event was created. For events representing a span of time, this is the end of the time span. |
| START_TIMESTAMP | TIMESTAMP_NTZ | For events representing a span of time, such as trace events, the start of the time span as a UTC timestamp. |
| OBSERVED_TIMESTAMP | TIMESTAMP_NTZ | A UTC time used for logs. Currently the same value as for TIMESTAMP. |
| TRACE | OBJECT | Tracing context for all signal types. Contains string values trace_id and span_id. |
| RESOURCE | OBJECT | Reserved for future use. |
| RESOURCE_ATTRIBUTES | OBJECT | Attributes that identify the source of an event such as database, schema, user, warehouse, Openflow, etc. |
| SCOPE | OBJECT | Scopes for events. For example, class names for logs. |
| SCOPE_ATTRIBUTES | OBJECT | Reserved for future use. |
| RECORD_TYPE | STRING | 事件类型。以下其中一项:
|
| RECORD | OBJECT | Fixed values for each record type, as described in RECORD 列. |
| RECORD_ATTRIBUTES | OBJECT | Variable attributes for each record type, as described in RECORD_ATTRIBUTES 列. |
| VALUE | VARIANT | Primary event value. |
| EXEMPLARS | ARRAY | Reserved for future use. |
按事件类型获取的数据
日志数据
| 属性 | 描述 |
|---|---|
| OBSERVED_TIMESTAMP | 当前值与 TIMESTAMP 的值相同。 |
| RECORD | The severity level recorded by the log event. |
| RECORD_ATTRIBUTES | 代码中发出日志事件的位置。这些值因语言而异,但可以包括代码文件路径、函数名称、行号等。 |
| RECORD_TYPE | The event type: LOG for a log message |
| RESOURCE_ATTRIBUTES | 用于标识事件源(例如数据库、架构、用户、仓库等)的属性。 |
| SCOPE | 事件发生的作用域,例如创建日志事件的类的名称。 |
| TIMESTAMP | 事件创建时的时间戳。 |
| VALUE | 日志消息。 |
指标数据
| 属性 | 描述 |
|---|---|
| RECORD | 对于指标事件,为包含指标名称和单位的对象。 |
| RECORD_TYPE | The event type: METRIC for a metric data point. |
| RESOURCE_ATTRIBUTES | 用于标识事件源(例如数据库、架构、用户或仓库)的属性。 |
| START_TIMESTAMP | When the RECORD column metric_type value is sum, this is the time when the metric was collected. Not used when the metric_type value is gauge. |
| TIMESTAMP | 事件创建时的时间戳。 |
| VALUE | 指标的数值。 |
跟踪事件的数据
| 属性 | 描述 |
|---|---|
| RECORD | For a span, an object that includes the span’s name and kind; for a span event, the object includes the span’s name. |
| RECORD_ATTRIBUTES | Attribute data associated with a span or span event. |
| RECORD_TYPE | The event type: SPAN for a span, SPAN_EVENT for a span event. |
| RESOURCE_ATTRIBUTES | 用于标识事件源(例如数据库、架构、用户、仓库等)的属性。 |
| START_TIMESTAMP | 适用于 span、span 开始的时间。不适用于 span 事件。 |
| TIMESTAMP | 事件创建时的时间戳。 |
| TRACE | Identifiers trace_id and span_id for a span and the span events within it. |
Data for Iceberg automated refresh events¶
Snowflake logs an event to your event table when it processes a snapshot for Iceberg automated refresh. The following table describes the columns for Iceberg automated refresh events:
| 属性 | 描述 |
|---|---|
| TIMESTAMP | 事件创建时的时间戳。 |
| RESOURCE_ATTRIBUTES | 用于标识事件源(例如数据库、架构、用户或仓库)的属性。 |
| RECORD_TYPE | The event type EVENT. |
| RECORD | Detailed information about the status of the operation associated with the event, including name and severity. |
| RECORD_ATTRIBUTES | Attributes associated with the event. |
| VALUE | Additional information specific to the event. |
EXEMPLARS 列¶
保留以供将来使用。
OBSERVED_ TIMESTAMP 列¶
日志的 UTC 时间戳。不用于跟踪事件。
RECORD 列¶
提供有关事件的核心信息,包括日志事件的日志级别或跟踪事件(span 或 span 事件记录)的名称。
Attributes, if any, for the record are recorded in the RECORD_ATTRIBUTES column.
Values contained by this column will vary depending on the value of the RECORD_TYPE column
(LOG, SPAN or SPAN_EVENT), as described in the following sections.
For LOG RECORD_ TYPE¶
When the RECORD_TYPE column value is LOG, the RECORD column value contains the severity of the log message. The column value may
contain the following keys:
| Key | Type | Description |
|---|---|---|
severity_text | STRING | 日志严重性的文本。以下其中一项:
When the log entry is for an unhandled exception, this value
is the highest-severity error level for the current language runtime. For example, for code written in Python, the value is |
示例
For METRIC RECORD_ TYPE¶
指标为 CPU 和由 Snowflake 生成的内存数据。您可以使用此数据来分析资源消耗。
The execution handler language and its environment significantly affect the meaning of the metrics data. See Emitting metrics data from handler code for more information.
| Key | Type | Description |
|---|---|---|
metric.name | string | 按行记录的指标的名称。以下其中一项:
For more information, see Emitting metrics data from handler code. |
metric.unit | string | The units of the metric; for example, bytes. |
metric_type | string | The OpenTelemetry Metric Point type of the metric data; for example, sum or gauge. |
value_type | string | The data type of the value in the VALUE column; for example, DOUBLE or INT. |
示例
For SPAN RECORD_ TYPE¶
span 表示函数和过程的单独执行。对于存储过程,有单个 span。对于用户定义的函数,单个函数调用可能有多个 span,具体取决于 Snowflake 如何决定计划执行。
All spans for a given query have the same value for the trace_id key of the TRACE column.
The duration of a span is the difference between the values in the start_timestamp and timestamp columns, indicating the
time of the beginning and end of the span execution, respectively.
span 和查询跟踪的 ID 使用 TRACE 列中的值表示。
Snowflake 将为每个执行创建一个 span,具有如下所示的键:
| Key | Type | Description |
|---|---|---|
dropped_attributes_count | int | The number of attributes ignored after the recorded maximum has been reached. |
name | string | 当可执行文件的处理程序用 Python 编写时,那么它就标识了发出数据的函数或过程的处理程序。这因可执行文件类型而异,如下所示:
When the traced code is written in SQL, such as a SQL statement executed within a procedure, this is the name of the executed
statement, such as When the executable’s handler is written in a language other than Python or SQL, this is a fixed value such as
|
kind | string | SPAN_KIND_SERVER when the traced code is written in SQL. Otherwise, this is the fixed value SPAN_KIND_INTERNAL. |
parent_span_id | Hex string | Identifies the span of the procedure or UDF from which the current trace passed. When this value is present, it means that the
current procedure or UDF call was made by another procedure in a call chain relationship. That “parent” procedure’s
|
snow.process.memory.usage.max | string | Optional. When present, specifies the maximum amount of memory, in bytes, used during this span’s execution. |
status | string |
|
对于用户定义的函数,Snowflake 可以添加 span 属性,指示函数处理和发出的行数。
For SPAN_EVENT RECORD_ TYPE¶
span 事件是附加到特定 span 执行的事件记录,如上所述。您可以创建事件以满足应用程序的需求。span 事件数上限为 128 个。
TRACE 列的值将标识事件创建的 span。
Span events have a single key, name, and can have arbitrary attributes added in the RECORD_ATTRIBUTES column.
| 键 | 类型 | 描述 |
|---|---|---|
name | 字符串 | span 事件的名称。 |
For EVENT RECORD_ TYPE for Iceberg automated refresh events¶
| Key | Type | Description |
|---|---|---|
name | VARCHAR | The name of the event; for example, iceberg_auto_refresh_snapshot_lifecycle |
severity_text | VARCHAR | 日志严重性的文本。以下其中一项:
The severity text when the
The |
For EVENT RECORD_ TYPE for Snowflake Native Apps lifecycle events¶
| Key | Type | Description |
|---|---|---|
name | VARCHAR | The name of the event; for example, application.state_change |
severity_number | NUMBER | The severity number of the event. |
severity_text | VARCHAR | 日志严重性的文本。以下其中一项:
|
RECORD_ ATTRIBUTES 列¶
使用由 Snowflake 或代码设置的元数据描述事件。该值将因行包含的记录类型而异,如以下部分所述。
For LOG RECORD_ TYPE¶
代码中发出日志事件的位置,包括代码文件路径、函数名称、行号等。
除了下面列出的属性外,您还可以添加自己的属性,以便将其包含在 RECORD_ATTRIBUTES 值中。
| 属性 | 类型 | 描述 |
|---|---|---|
code.filepath | 整数 | 包含生成消息的代码的文件。 |
code.function | 字符串 | 生成消息的函数的名称。 |
code.lineno | 整数 | 代码中生成消息的行号。 |
code.namespace | 整数 | 生成消息的代码的命名空间。 |
exception.message | 字符串 | The error message from an unhandled exception. |
exception.type | 字符串 | The name of the class for an unhandled exception. |
exception.stacktrace | 字符串 | An unhandled exception’s stack trace formatted by a language runtime. |
exception.escaped | 布尔 | true if this entry is from an unhandled exception. |
thread.id | 整数 | 用于创建日志事件的线程。 |
thread.name | 字符串 | 用于创建日志事件的线程。 |
示例
In the following example, all attributes have been added by Snowflake except employee.id, which was added by a custom attribute.
For SPAN RECORD_ TYPE¶
记录 span 时为 span 分配的属性(如果有)。属性名称和值由代码或 Snowflake 设置。
下表列出了 Snowflake 可能设置的属性。
| 属性 | 类型 | 描述 |
|---|---|---|
db.query.executable.names | 字符串 | 在此时间段内跟踪的查询下执行的可执行文件的名称。 |
db.query.table.names | 字符串 | 在此时间段内跟踪的查询中读取或修改的表的名称。 |
db.query.view.names | 字符串 | 在此时间段内跟踪的查询中访问的视图的名称。 |
db.query.text | 字符串 | The text of the SQL query traced in this span. Included only if SQL trace query text is enabled for tracing. For more information, see SQL statement tracing. |
snow.input.rows | 整数 | 函数的 span 处理的输入行数。 |
snow.output.rows | 整数 | 函数的 span 成功处理的输出行数。 |
示例
以下示例中的代码包括 Snowflake 设置的属性。
示例
以下示例中的代码包括由处理程序代码设置的属性。
For SPAN_EVENT RECORD_ TYPE¶
记录 span 事件时为事件分配的属性(如果有)。属性名称和值可以由 Snowflake 或用户代码设置。
示例
以下示例中的代码包括由处理程序代码设置的属性。
For EVENT RECORD_ TYPE for Iceberg automated refresh events¶
Attributes assigned to the EVENT event when it is recorded for Iceberg automated refresh. Attribute names and values are set by Snowflake.
| 属性 | 类型 | 描述 | 示例 |
|---|---|---|---|
snow.snapshot.id | 整数 | The ID of the Iceberg snapshot being processed during Iceberg automated refresh. NULL if the automated refresh process fails. | 12345 |
RECORD_ TYPE 列¶
指定事件表行描述的记录的类型。此列的值标识事件表可能包含三类记录中哪类记录的数据。
The RECORD column contains this record’s data. The RECORD_ATTRIBUTES column contains this record’s metadata, if any.
下表列出了此列的可能值。
| Column Value | Description |
|---|---|
LOG | The row represents a log entry generated by handler code. |
SPAN | 该行表示一个 span。 对于存储过程,有单个 span。对于可以并行化的用户定义函数,执行该函数的每个线程都有一个 span。线程数将因多种因素而异,包括执行函数的 Snowflake 仓库的大小。 A span may contain multiple span events. For more information, see Span data recorded. |
SPAN_EVENT | 该行表示一个 span 事件。一个特定 span 可以附加多个 span 事件记录。处理程序代码可能会创建事件以满足您的需求。span 事件数上限为 128 个。 |
METRIC | The row represents an observation of a metric. Multiple observations of multiple metrics can be associated with a particular span. |
EVENT | The row represents an event associated with a particular operation, such as Iceberg automated refresh. |
RESOURCE 列¶
保留以供将来使用。
RESOURCE_ ATTRIBUTES 列¶
根据 Snowflake 对象描述事件的源。
构成此列值的属性由 Snowflake 设置,无法更改。
事件源的资源属性
Note
When the event source is Iceberg automated refresh, only the following attribute types are set:
- :code:
snow.application.name - :code:
snow.executable.name - :code:
snow.database.name - :code:
snow.schema.name - :code:
snow.executable.name
| Attribute Name | Attribute Type | Description | Example |
|---|---|---|---|
snow.catalog.integration.name | string | The name of the catalog integration associated with the executable for Iceberg automated refresh. | MY_CATALOG_INTEGRATION_NAME |
snow.catalog.table.name | string | The name of the Iceberg table in the catalog. | MY_CATALOG_TABLE_NAME |
snow.database.id | int | The internal/system-generated identifier of the database containing the executable. | 12345 |
snow.database.name | string | The name of the database containing the executable. | MY_DATABASE |
snow.executable.id | int | The internal/system-generated identifier of the executable (procedure, function, SnowService, etc.) generating the event. | 12345 |
snow.executable.name | string | The name of the executable generating the event. For example, this might be the name of the procedure, function, or Streamlit app. | MY_UDF |
snow.executable.runtime.version | string | 可执行语言的运行时版本。这将是特定于语言的值,如下所述:
| procedure |
snow.executable.type | string | 以下其中一项:
| procedure |
snow.owner.id | int | The internal/system-generated identifier of the role with OWNERSHIP privilege for the executable. | 1234 |
snow.owner.name | string | The name of the role with OWNERSHIP privilege for the executable. | UDF_OWNER_RL |
snow.schema.id | int | The internal/system-generated identifier of the schema containing the executable. | 12345 |
snow.schema.name | string | The name of the schema containing the executable. | MY_SCHEMA |
snow.table.name | string | The name of the table associated with the executable. | MY_TABLE_NAME |
telemetry.sdk.language | string | The language of the resource/SDK. Snowflake uses java, scala, python, javascript and sql. | java |
执行环境的资源属性
| 属性 | 类型 | 描述 | 示例 |
|---|---|---|---|
db.user | 字符串 | 对于函数或过程,这是指执行该函数或过程的用户的名称。对于 Streamlit 应用程序,这是指在某一事件中查看该应用程序的用户的名称。 | MY_USER_NAME |
snow.query.id | 字符串 | 查询的 ID。 | 01a6aeb7-0604-c466-0000-097127d13812 |
snow.release.version | 字符串 | 生成事件时运行的 Snowflake 版本 | 7.9.0 |
snow.session.id | 整数 | 运行可执行文件的会话的 ID。 | 10 |
snow.session.role.primary.id | 整数 | 会话中主要角色的内部/系统生成的标识符。 | 10 |
snow.session.role.primary.name | 字符串 | 会话中主要角色的名称。 | MY_ROLE |
snow.user.id | 整数 | 运行查询的用户的内部/系统生成的标识符。 | 1234 |
snow.warehouse.id | 整数 | 运行(生成事件的)查询的仓库的内部/系统生成的标识符。 | 12345 |
snow.warehouse.name | 字符串 | 运行(生成事件的)查询的仓库的名称。 | MY_WAREHOUSE |
应用程序的资源属性
| 属性 | 类型 | 描述 | 示例 |
|---|---|---|---|
snow.application.consumer.account_locator | 字符串 | For a Snowflake Native App, the account locator of the consumer’s account. | XY12345 |
snow.application.consumer.account_name | 字符串 | For a Snowflake Native App, the name of the consumer’s account. | MY_CONSUMER_ACCOUNT |
snow.application.consumer.name | 字符串 | For a Snowflake Native App, the account locator of the consumer’s account (deprecated; use snow.application.consumer.account_locator instead). | XY12345 |
snow.application.consumer.organization | 字符串 | For a Snowflake Native App, the name of the consumer’s organization. | CONSUMER_ORG_NAME |
snow.application.consumer.snowflake_region | 字符串 | For a Snowflake Native App, the Snowflake region of the consumer’s account. | AWS_US_WEST_2 |
snow.application.id | 字符串 | For a Snowflake Native App, the internal/system-generated identifier of the app. | ABCZN3J3 |
snow.application.name | 字符串 | For a Snowflake Native App, the name of the app. | MY_INSTALLED_APP_NAME |
snow.application.package.name | 字符串 | For a Snowflake Native App, the name of the application package. | MY_INSTALLED_PACKAGE_NAME |
snow.listing.global_name | 字符串 | For a Snowflake Native App, the internal/system-generated identifier of the listing. | GZYZN3J3 |
snow.listing.name | 字符串 | For a Snowflake Native App, the name of the listing. | MY_LISTING_NAME |
Snowflake 版本的资源属性¶
| 属性 | 类型 | 描述 | 示例 |
|---|---|---|---|
service.version | 字符串 | The version of the executable, where relevant. The combination of snow.version and snow.patch joined by a dot where they exist. Standard OpenTelemetry attribute. | 2.3.1 |
snow.patch | 字符串 | 正在运行的可执行文件的补丁级别。 | 1 |
snow.version | 字符串 | 正在运行的可执行文件的版本。 | 2.3 |
示例
SCOPE 列¶
适用于日志事件,发出事件的代码的命名空间,例如创建日志条目的类的名称。这不用于跟踪事件。
下表列出了此列中可能包含的属性。
范围值
| 属性 | 类型 | 描述 | 示例 |
|---|---|---|---|
name | 字符串 | 发出事件的代码的命名空间。 | com.sample.MyClass |
示例
SCOPE_ ATTRIBUTES 列¶
保留以供将来使用。
START_ TIMESTAMP 列¶
span 以 UTC 时间戳开始的时间。
| RECORD_TYPE Column Value | START_TIMESTAMP Value Description |
|---|---|
LOG | Not used. |
SPAN | The time the span started. |
SPAN_EVENT | Not used. |
METRIC | When the RECORD column metric_type value is sum, this is the time when the metric was collected. Not used when the metric_type value is gauge. |
TIMESTAMP 列¶
发出事件的时间。该值的含义将因行所表示的记录类型而异,如下表所示:
| RECORD_TYPE Column Value | TIMESTAMP Value Description |
|---|---|
LOG | The wall-clock time that the event was emitted. |
SPAN | The time at which execution concluded. |
SPAN_EVENT | The wall-clock time that the event was emitted. |
TRACE 列¶
表示函数和过程执行的唯一标识符。
| RECORD_TYPE Column Value | TRACE Value Description |
|---|---|
LOG | Not used. |
SPAN | trace_id and span_id |
SPAN_EVENT | trace_id and span_id |
跟踪值
下表列出了此列中可能包含的属性。
| Attribute | Type | Description | Examples |
|---|---|---|---|
span_id | Hex string | A unique identifier to the threading model. Procedures, which are single-threaded, will have a single When the current span is from a procedure that called another procedure or UDF in the trace, this | b4c28078330873a2 |
trace_id | Hex string | A unique identifier for calls made from a query. When a stored procedure is not being called in a chain of calls, each call has
its own When a procedure is called by another procedure or UDF in a call chain, it has the same 此值对于每个查询均唯一,并且对于查询中的所有 span 均相同。您可以使用它对单个查询执行中的事件进行分组。 | 6992e9febf0b97f45b34a62e54936adb |
示例
以下示例中的代码显示 span 或 span 事件将存在的属性。
VALUE 列¶
- For log events, this is usually the log message. When the event logged is for an
unhandled exception, the value in this column will be simply
exception. - 对于指标,这是指标的数值。
请注意,VALUE 列的类型为 VARIANT(不是 STRING),因此它可以具有某些语言(例如 JavaScript)的非字符串值。
For EVENT VALUE for Iceberg automated refresh events¶
| Key | Type | Description | Example |
|---|---|---|---|
metadata_file_location | VARCHAR | The location of the Iceberg metadata file, which can be NULL if the automated refresh process failed. | "s3china://my_bucket/iceberg_snapshots/metadata/...metadata.json" |
snapshot_state | VARCHAR | 按行记录的指标的名称。以下其中一项:
| "errored" |
error_message | VARCHAR | If the value in snapshot_state is errored, this column includes an error message. | “Iceberg Auto Refresh encountered a fatal error. Please disable Auto Refresh and manually refresh the table before re-enabling Auto Refresh. FailedMetadataFile: s3china://my_bucket/…, FailedSnapshotId: null.n” |
For EVENT VALUE for Snowflake Native Apps application lifecycle events¶
| Key | Type | Description |
|---|---|---|
upgrade_state | VARCHAR | The current state of the background installation or upgrade. |
upgrade_attempt | VARCHAR | Indicates whether an upgrade was attempted for the app. |
target_upgrade_version | VARCHAR | The version of the app that is running or pending upgrade. |
target_upgrade_patch | VARCHAR | The version patch level of the app that is running or pending upgrade. |
upgrade_failure_reason | VARCHAR | The reason the upgrade failed, if applicable. |
health_status | VARCHAR | The health status of the app. Possible values:
|
action | VARCHAR | The action applied to privileges during installation or upgrade. Possible values:
|
privileges | VARCHAR | A list of privileges that were granted or revoked during installation or upgrade. |