1.3 KiB
1.3 KiB
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).POST /api/metrics— declare a metric (002).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 existingLogsParams/TimelineParamspattern indto.rs.- Follow the existing engine architecture: new
EngineQuery/EngineMessagevariants, handled inengine.rs's single-owner loop, DTOs added todto.rs, routes added toapi.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.