mirror of
https://github.com/agent-substrate/substrate.git
synced 2026-10-26 07:23:59 +08:00
Component authors had the metric registry and the cardinality rules but no single place that says how to add an instrument: which kind to pick, how to name it, which labels are allowed, how the Go is shaped, how to test it with a ManualReader, and how to register it. Each of those conventions existed only as a pattern in one of the metrics.go files. The guide sits beside tracing.md and otel-collector.md. It uses the instruments already in the tree as the examples, ends with a worked example of a node-local snapshot cache (a counter by outcome, a fill histogram, a size gauge and an eviction counter, and what is deliberately not a label). The registry snippets in the guide pass `weaver registry check` when appended to the real registry. observability.md and AGENTS.md now point at the guide from the place that already told contributors to update the registry. Fixes #1552 > It's a good idea to open an issue first for discussion. - [x] Tests pass - [x] Appropriate changes to documentation are included in the PR