Merge branch 'worktree-agent-a63474e92b05425a5'
# Conflicts: # Cargo.lock # Cargo.toml
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# 004 — Metrics API
|
||||
|
||||
## Summary
|
||||
|
||||
Expose param/metric declarations and bucket data over HTTP so the frontend (and the
|
||||
filter/dashboard query engines) can declare metrics and read their values.
|
||||
|
||||
## Scope
|
||||
|
||||
- `POST /api/params` — declare a param ([001](001-param-declarations.md)).
|
||||
- `POST /api/metrics` — declare a metric ([002](002-metric-declarations.md)).
|
||||
- `GET /api/metrics` — list declared metrics (+ their declared params/labels).
|
||||
- `GET /api/metrics/:name` — query bucket values for a metric, filtered by label
|
||||
selector and time/sequence range, mirroring the existing `LogsParams`/
|
||||
`TimelineParams` pattern in `dto.rs`.
|
||||
- Follow the existing engine architecture: new `EngineQuery`/`EngineMessage` variants,
|
||||
handled in `engine.rs`'s single-owner loop, DTOs added to `dto.rs`, routes added to
|
||||
`api.rs`'s router — no new locking or shared state.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- Declaring a param/metric via the API round-trips through to engine state and shows
|
||||
up in `GET /api/metrics`.
|
||||
- Querying a metric's bucket values supports the same start/end and limit-style
|
||||
params as the existing logs/timeline endpoints.
|
||||
- Bad declarations (invalid regex etc.) return a 4xx with a useful error body, not a
|
||||
500 or silent no-op.
|
||||
|
||||
## Depends on
|
||||
|
||||
- [003 — Metric bucket derivation](003-metric-bucket-derivation.md)
|
||||
Reference in New Issue
Block a user