跳转至

数据采集可用性检测

·


该采集器用于检测数据采集的可用性和延迟。它会自动生成探测数据(指标、日志、链路追踪),然后通过 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 (指标)

Synthetic metric points emitted by the collector per probe round to verify metric ingestion path.

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: count
Tagged by: test_type

ingestion_canary (日志)

Synthetic logging payload emitted by the canary to verify logging ingestion path.

Tags & Fields Description
test_type
(tag)
Test type: collect (collector) or cmd (CLI tool)
message Synthetic log message emitted by the ingestion canary probe.
Type: string
Unit: N/A
Tagged by: test_type
round Round number of the ingestion canary probe.
Type: int
Unit: count
Tagged by: test_type

ingestion_canary (链路追踪)

Synthetic tracing payload emitted by the canary to verify trace collection and forwarding.

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 Trace span duration in microseconds.
Type: int
Unit: time,μs
Tagged by: service, source, span_type, test_type
parent_id Parent span identifier emitted by the ingestion canary probe.
Type: string
Unit: N/A
Tagged by: service, source, span_type, test_type
resource Synthetic resource name emitted by the ingestion canary probe.
Type: string
Unit: N/A
Tagged by: service, source, span_type, test_type
round Round number of the ingestion canary probe.
Type: int
Unit: count
Tagged by: service, source, span_type, test_type
span_id Span identifier emitted by the ingestion canary probe.
Type: string
Unit: N/A
Tagged by: service, source, span_type, test_type
start Trace span start time as a Unix timestamp in microseconds.
Type: int
Unit: timeStamp,usec
Tagged by: service, source, span_type, test_type
status Synthetic span status emitted by the ingestion canary probe.
Type: string
Unit: N/A
Tagged by: service, source, span_type, test_type
trace_id Trace identifier emitted by the ingestion canary probe.
Type: string
Unit: N/A
Tagged by: service, source, span_type, test_type

结果指标

ingestion_canary_result

Result metrics of each ingestion canary probe round, including category, status, storage destination and latency.

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 feeding a canary point until it becomes queryable, in milliseconds.
Type: int | (gauge)
Unit: time,ms
Tagged by: category, status, storage_index, test_type

命令行工具

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

# 使用默认配置
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 秒。

文档评价

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