跳到主要内容
跳到主要内容

system.trace_log

Querying in ClickHouse Cloud

このシステムテーブルのデータは、ClickHouse Cloudの各ノードにローカルで保管されています。そのため、すべてのデータの完全なビューを取得するには、clusterAllReplicas 関数が必要です。詳細については こちら をご覧ください。

包含由 sampling query profiler 收集的堆栈跟踪信息。

trace_log 服务器配置部分被设置时,ClickHouse 会创建此表。另请参阅设置: query_profiler_real_time_period_ns, query_profiler_cpu_time_period_ns, memory_profiler_step, memory_profiler_sample_probability, trace_profile_events

要分析日志,请使用 addressToLineaddressToLineWithInlinesaddressToSymboldemangle 反射函数。

列:

  • hostname (LowCardinality(String)) — 执行查询的服务器的主机名。

  • event_date (Date) — 采样时刻的日期。

  • event_time (DateTime) — 采样时刻的时间戳。

  • event_time_microseconds (DateTime64) — 采样时刻的时间戳,微秒精度。

  • timestamp_ns (UInt64) — 采样时刻的时间戳(纳秒)。

  • revision (UInt32) — ClickHouse 服务器构建修订版本。

    通过 clickhouse-client 连接到服务器时,您会看到类似于 Connected to ClickHouse server version 19.18.1. 的字符串。此字段包含 revision ,但不包含服务器的 version

  • trace_type (Enum8) — 跟踪类型:

    • Real 表示通过实际时间收集堆栈跟踪。
    • CPU 表示通过 CPU 时间收集堆栈跟踪。
    • Memory 表示当内存分配超过后续水印时收集分配和解除分配。
    • MemorySample 表示收集随机分配和解除分配。
    • MemoryPeak 表示收集峰值内存使用情况的更新。
    • ProfileEvent 表示收集配置事件的增量。
  • thread_id (UInt64) — 线程标识符。

  • query_id (String) — 查询标识符,可以用于获取来自 query_log 系统表的查询详细信息。

  • trace (Array(UInt64)) — 采样时刻的堆栈跟踪。每个元素是 ClickHouse 服务器进程中的虚拟内存地址。

  • size (Int64) - 对于 MemoryMemorySampleMemoryPeak 跟踪类型,表示分配的内存量,对于其他跟踪类型为 0。

  • event (LowCardinality(String)) - 对于 ProfileEvent 跟踪类型,是更新的配置事件的名称,对于其他跟踪类型为空字符串。

  • increment (UInt64) - 对于 ProfileEvent 跟踪类型,是配置事件的增量,对于其他跟踪类型为 0。

  • symbols (Array(LowCardinality(String))),如果启用了符号化,则包含与 trace 对应的解码符号名称。

  • lines (Array(LowCardinality(String))),如果启用了符号化,则包含与 trace 对应的带行号的文件名字符串。

可以在服务器的配置文件中,trace_log 下的 symbolize 中启用或禁用符号化。

示例