跳转至

数据采集可用性检测

·


该采集器用于检测数据采集的可用性和延迟。它会自动生成探测数据(指标、日志、链路追踪),然后通过 DQL 查询来验证数据是否成功采集,并测量从数据发送到可查询的延迟时间。

前置条件

  • 需要配置 DataWay,用于数据上报和 DQL 查询
  • 如果配置了 result_workspace,需要确保该工作空间 URL 可访问

配置

进入 DataKit 安装目录下的 conf.d/samples 目录,复制 ingestion_canary.conf.sample 并命名为 ingestion_canary.conf。示例如下:

[[inputs.ingestion_canary]]
  ## Collect interval, default 10m
  interval = "10m"

  ## Query timeout, should be less than interval, default 5m
  query_timeout = "5m"

  ## Poll interval for DQL query, default 500ms
  poll_interval = "500ms"

  ## Max retry count for query errors, default 10
  error_retries = 10

  ## Result workspace URL to report metrics
  # result_workspace = "https://openway.guance.com?token=xxx"

  ## Data categories to collect (metric, logging, tracing)
  ## If not specified, all categories will be collected
  categories = ["metric", "logging", "tracing"]

  ## Logging configuration
  [inputs.ingestion_canary.logging]
    storage_index = "default"

  ## Enable election mode
  election = true

  ## Extra tags
  [inputs.ingestion_canary.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"

配置好后,重启 DataKit 即可。

指标说明

该采集器会生成两类数据:

  1. 测试数据:用于测试数据采集可用性的探测数据点(指标、日志、链路追踪)
  2. 结果指标:测试结果的指标数据,包含延迟时间和测试状态

探测数据点不携带全局标签,只包含数据点自身的字段和标签,以及配置中指定的 tags

测试数据

ingestion_canary (指标)

Tags & Fields Description
test_type
(tag)
Test type: collect (collector) or cmd (CLI tool)
round Round number of the ingestion canary probe
Type: int | (gauge)
Unit: -

ingestion_canary (日志)

Tags & Fields Description
test_type
(tag)
Test type: collect (collector) or cmd (CLI tool)
message Synthetic freshness probe message
Type: string
Unit: -
round Round number of the ingestion canary probe
Type: int
Unit: -

ingestion_canary (链路追踪)

Tags & Fields Description
service
(tag)
Service name
source
(tag)
Source name
span_type
(tag)
Span type
test_type
(tag)
Test type: collect (collector) or cmd (CLI tool)
duration Duration in microseconds
Type: int
Unit: time,μs
parent_id Parent span ID
Type: string
Unit: -
resource Resource name
Type: string
Unit: -
round Round number of the ingestion canary probe
Type: int
Unit: -
span_id Span ID
Type: string
Unit: -
start Start time in microseconds
Type: int
Unit: timeStamp,usec
status Span status
Type: string
Unit: -
trace_id Trace ID
Type: string
Unit: -

结果指标

ingestion_canary_result

Tags & Fields Description
category
(tag)
Data category: M (metric), L (logging), T (tracing)
status
(tag)
Test status: ok, timeout, error
storage_index
(tag)
Storage index for logging data (optional)
latency_ms Latency from feed to queryable in milliseconds
Type: int | (gauge)
Unit: time,ms

命令行工具

除了采集器模式,还提供了命令行工具用于一次性测试:

# 使用默认配置
datakit tool --ingestion-canary

# 指定日志数据的 storage index
datakit tool --ingestion-canary --ingestion-canary-index my_index

参数说明:

  • --ingestion-canary: 启用 ingestion canary 测试工具
  • --ingestion-canary-index: 指定日志数据的 storage index,默认为 "default"(仅对日志数据有效)

功能说明:

该工具会生成一轮探测数据(指标、日志、链路追踪),发送到 DataWay 后持续查询直到找到数据或用户中断,并输出各数据类型的延迟时间。工具会持续运行,每轮测试间隔 10 秒。

文档评价

文档内容是否对您有帮助? ×