1.6 KiB
1.6 KiB
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).
Scope
IndexKey::MetricDeclaration { name }paired withDataValue::MetricDeclaration(already sketched indata_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 (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
(
MetricDeclarationbetweenParamMetricSplitandMetricBucketSplit).
Depends on
- 001 — Param declarations (shares matcher/primitive validation code and the "derive a value from a regex capture" concept).