Repository for the generic time-series metric_samples table
(MET-001). Backs every "value over time per project" surface — healing
savings (CAP-004), Web Vitals trends (AUTO-017.3), flaky-rate (DIF-004),
accessibility violations (AUTO-016) — so each consumer doesn't reinvent
its own aggregation table.
Schema (migration 016_metric_samples.sql):
metric_samples(id, projectId, metricKey, ts, value, tags, createdAt)
indexed on (projectId, metricKey, ts)
tags is JSON-serialised on write and parsed on read so callers can
attach structured context (e.g. { testId, strategy }) without a
separate join table.
Methods
(static) getSeries(projectId, metricKey, optsopt) → {Array.<{ts: number, value: number, tags: (Object|null)}>}
Read a project's samples for a metric, ordered ascending by timestamp.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | |||||||||||||||||
metricKey |
string | |||||||||||||||||
opts |
Object |
<optional> |
Properties
|
Returns:
- Type
- Array.<{ts: number, value: number, tags: (Object|null)}>
(static) insertSample(sample)
Insert a single time-series sample.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
Object |
Properties
|