Merge branch 'worktree-agent-a63474e92b05425a5'

# Conflicts:
#	Cargo.lock
#	Cargo.toml
This commit is contained in:
Hugh Kaznowski
2026-09-05 12:46:45 +01:00
28 changed files with 958 additions and 3 deletions
+35
View File
@@ -0,0 +1,35 @@
# 002 — Metric declarations
## Summary
Implement the `MetricDeclaration` slice of the index: a language/API for declaring a
metric — a regex that matches a log message plus params extracted from it — so that
matching logs can later be bucketed ([003](003-metric-bucket-derivation.md)).
## Scope
- `IndexKey::MetricDeclaration { name }` paired with `DataValue::MetricDeclaration`
(already sketched in `data_value.rs`: `message_match_regex` +
`Vec<RegexToMetricPrimitiveMatcher>`).
- Engine message(s) to add/list/remove a metric declaration.
- A metric declaration's params may reference params already declared via
[001](001-param-declarations.md) (e.g. label a bucket by an existing param) in
addition to inline capture groups on the metric's own regex — decide and document
which is supported for v1 (README implies inline capture-group derivation is the
primary mechanism: "buckets and parameters can be derived" from the metric
declaration itself).
- Validate the regex and capture-group → primitive-kind mapping at declaration time,
same as param declarations.
## Acceptance criteria
- Declaring a metric with a valid regex + param matchers succeeds and is retrievable.
- Invalid regex, or a matcher referencing a capture group the regex doesn't have, is
rejected at declaration time.
- Declarations sit in their own contiguous range of the BTreeMap
(`MetricDeclaration` between `ParamMetricSplit` and `MetricBucketSplit`).
## Depends on
- [001 — Param declarations](001-param-declarations.md) (shares matcher/primitive
validation code and the "derive a value from a regex capture" concept).