Skip to main content

Crate wist_metrics

Crate wist_metrics 

Source
Expand description

Metrics collection contract shared by system collectors (in wist-agentd) and non-system collectors (database / external services, kept here to isolate heavy drivers).

This crate owns the W4「契约层 + 采集层抽象」:

  • provider:MetricProvider trait 与采集结果类型(collect → samples 的中转结构);
  • target:采集目标视图条目(provider 的输入);
  • spec:指标声明表(fact_key → 规范化指标名/单位/类型);
  • names:非 fact 派生的规范名(agent 自观测 agent_*)、序列 label 键与单位换算 —— 写入端(agentd)与读取端(网关 / 中心)共同引用,名字只改一处。

系统指标(host/process/container)的 provider 仍在 wist-agentd 里实现;非系统指标 (Postgres / MySQL / …)的 provider 放本 crate,其重依赖(如 sqlx)以 feature 门控, 不进入 wist-agentd 的默认依赖图。

Modules§

names
规范指标名 / label 键 / 单位换算的常量表。
provider
采集层抽象:MetricProvider trait 与一次采集的结果类型。
spec
指标契约(spec):把采集侧 runtime fact 规范化成指标的声明式映射。
target
采集目标视图条目:provider 采集的输入(一个「采什么」的候选目标)。