Metric Correlations
CI / test (push) Successful in 1m3s
Release rolling / release (push) Has been cancelled

This commit is contained in:
Raven Scott
2026-07-18 22:43:42 -04:00
parent 5396d9d499
commit 93a239e8ef
11 changed files with 1258 additions and 31 deletions
+17 -6
View File
@@ -69,8 +69,10 @@ Do not name third-party products in code, commits, or user-facing copy.
- [x] Expand card: stats table (min/avg/max), dim table (click title)
- [x] Alert click → Charts wall, scroll to chart, pause near event time
- [x] Related metrics panel (context/family + series correlation)
- [x] Related metrics panel (context/family + Pearson — separate from MC)
- [x] Metric Correlations (highlight brush → `volume`/`ks2`/`anomaly-rate`/`value` → filtered wall)
- [x] Anomaly tint / threshold line on wall cards
- [x] Alert → Correlate around event timestamp
### P4 — Shell & persistence
@@ -91,10 +93,10 @@ Do not name third-party products in code, commits, or user-facing copy.
### Also shipped
- [x] Per-chart weights via `getWeights` RPC + `/api/v1|v2|v3/weights`
- [x] Related ranking boosted by anomaly weights
- [x] Weights / MC engine via `getWeights` RPC + `/api/v1|v2|v3/weights` (`server/services/weights.js`)
- [x] Related ranking boosted by alert weights when no MC window
- [x] Drag-reorder pinned charts
- [x] Keyboard shortcuts on Charts (`Space` play, `15` presets, `/` search, `f` force, `b` board, `r` reset, `Esc` clear related)
- [x] Keyboard shortcuts on Charts (`Space` play, `15` presets, `/` search, `f` force, `b` board, `c` correlate, `r` reset, `Esc` clear)
---
@@ -119,8 +121,9 @@ Do not name third-party products in code, commits, or user-facing copy.
| Path | Role |
|------|------|
| `shared/taxonomy.js` | Section defs + `groupCatalog()` |
| `shared/related-metrics.js` | Related-chart ranking |
| `ui/dashboard.js` | Metrics wall controller |
| `shared/related-metrics.js` | Related-chart ranking (taxonomy + Pearson) |
| `server/services/weights.js` | Metric Correlations scoring (ks2 / volume / AR / value) |
| `ui/dashboard.js` | Metrics wall controller + Correlate mode |
| `ui/charts.js` | Canvas paint + hover helpers |
| `index.html` | Charts view shell (TOC + wall + time bar) |
| `ui/styles.css` | Metrics shell layout |
@@ -143,3 +146,11 @@ Do not name third-party products in code, commits, or user-facing copy.
- Legacy single-chart detail panel removed; dblclick expands stats + related
- Hover pad shared with Y-axis; hero-aware resize; hover paint batched via rAF
- Fleet cards show CPU/RAM chips when available; empty → Connect CTA
## Metric Correlations vs Related
| | **Correlate** | **Related (⇢)** |
|--|---------------|-----------------|
| Goal | Find metrics that **changed** vs a baseline around a highlight | Find charts **related** to a seed chart |
| Engine | Server `weights.js` (`volume` / `ks2` / …) | Client taxonomy + Pearson |
| UX | Toolbar Correlate → brush ≥15s → Find Correlations → filtered wall | Per-card ⇢ / dblclick → related panel |
+19 -1
View File
@@ -137,6 +137,24 @@ Single-agent returns one node. With `PEARDATA_PARENT=1`, `/nodes` and `/fleet` i
- If you bind `0.0.0.0`, put REST behind a firewall, reverse proxy, or Holesail tunnel — do not expose raw metrics to the internet.
- Future: optional bearer gate (`/api/v3/bearer_protection` parity).
## Weights / Metric Correlations
`GET /api/v1/weights` · `/api/v2/weights` · `/api/v3/weights` (same engine; also RPC `getWeights`)
| Param | Notes |
|-------|--------|
| `method` | `volume` (default with window), `ks2`, `anomaly-rate`, `value`, `alerts` |
| `after` / `before` | Highlight window (unix seconds or relative, e.g. `after=-60&before=0`) |
| `baseline_after` / `baseline_before` | Optional; default = 4× highlight immediately preceding |
| `points` | Resolution (default 500 for MC methods) |
| `time_group` | Aggregation for `value` (default `cv`) |
| `contexts` / `charts` / `dimensions` | Optional filters |
| `limit` / `timeout` | Result cap / ms budget |
Without a highlight window, `method` defaults to **alerts** (active anomaly/alert weights — used by Related panel boost).
Response includes `method`, `view.highlight` / `view.baseline`, and `results[{ id, weight, context, family, info }]`. Higher `weight` = more changed / interesting.
## CORS
`Access-Control-Allow-Origin` defaults to `*` (override with `PEARDATA_REST_CORS`).
@@ -145,7 +163,7 @@ Single-agent returns one node. With `PEARDATA_PARENT=1`, `/nodes` and `/fleet` i
| Area | PearData |
|------|----------|
| ML weights / metric correlations | Per-chart anomaly weights; desktop related uses corr + weights |
| Weights / Metric Correlations | `GET /api/v*/weights` — highlight-vs-baseline scoring (`method=volume\|ks2\|anomaly-rate\|value`) or alert weights when no window; see below |
| Multi-node parent streaming | Single node; parent planned |
| Cloud POST spaces APIs | Not implemented (agent GET style only) |
| App/plugin charts (nginx, DB, …) | System/OS charts; plugins later |
+2 -1
View File
@@ -92,7 +92,7 @@ Template rebrand, protocol, collector, memory store, anomalies, REST, desktop MV
| Anomaly scoring + UI highlight | Done (score + panel tint + threshold line) |
| Notifications | Done (desktop + `PEARDATA_WEBHOOK_URL`) |
| Streaming z-score / retrain job | Done (`PEARDATA_ANOMALY_MODE`, job `retrainAnomaly`) |
| `/api/v3/weights` depth | Done (per-chart anomaly weights + `getWeights` RPC) |
| `/api/v3/weights` / Metric Correlations | Done — highlight-vs-baseline scoring (`ks2`/`volume`/`anomaly-rate`/`value`) + Charts Correlate UI |
---
@@ -133,6 +133,7 @@ shared time, multi-dim cards, investigation). Detail checklist:
| Drag-reorder pins + keyboard shortcuts | Done |
| Taxonomy coverage test + EXTENDING note | Done |
| Desktop polish (layout fill, plot domain, legacy detail removed, Fleet chips) | Done |
| Metric Correlations (weights engine + Correlate brush UI) | Done |
| Multi-named custom boards | Later |
**Phase 6 exit (P0)** — Charts tab lists every agent chart in sections; shared