Updates
This commit is contained in:
+9
-26
@@ -1,15 +1,14 @@
|
||||
# Swagger / metrics compatibility plan
|
||||
|
||||
Plan and verification against the upstream agent OpenAPI document:
|
||||
Plan and verification for PearData’s agent-style REST surface (`/api/v1|v2|v3`):
|
||||
|
||||
- Source: https://raw.githubusercontent.com/netdata/netdata/master/src/web/api/netdata-swagger.json
|
||||
- Spec: OpenAPI 3.0.0 — **68 paths / 72 operations** (GET/POST/PUT)
|
||||
- Spec shape: OpenAPI-style path inventory — **68 paths / 72 operations** used as a historical checklist (GET/POST/PUT)
|
||||
- PearData router: `server/rest/routes.js`
|
||||
- Chart catalog: `shared/metrics.js` + collectors under `server/services/`
|
||||
|
||||
This document answers two questions:
|
||||
|
||||
1. Which **REST operations** from the swagger does PearData implement?
|
||||
1. Which **REST operations** from that checklist does PearData implement?
|
||||
2. Which **metric charts / dimensions** (the data those APIs serve) are collected?
|
||||
|
||||
Verified: **2026-07-18** (static analysis of routes + collector emit sites; unit tests `73/73`).
|
||||
@@ -313,28 +312,12 @@ Legend:
|
||||
## Part E — How to re-verify
|
||||
|
||||
```bash
|
||||
# 1) Pull upstream OpenAPI
|
||||
curl -fsSL \
|
||||
https://raw.githubusercontent.com/netdata/netdata/master/src/web/api/netdata-swagger.json \
|
||||
-o /tmp/agent-swagger.json
|
||||
# 1) Diff documented REST paths against the router
|
||||
rg -o '/api/v[123]/[a-zA-Z0-9_./{}-]+' docs/REST-API.md docs/SWAGGER_PLAN.md | sort -u > /tmp/doc-paths.txt
|
||||
rg -o '/api/v[123]/[a-zA-Z0-9_./-]+' server/rest/routes.js | sort -u > /tmp/route-paths.txt
|
||||
comm -23 /tmp/doc-paths.txt /tmp/route-paths.txt || true
|
||||
|
||||
# 2) Diff path presence vs PearData router
|
||||
node -e "
|
||||
import { readFileSync } from 'fs'
|
||||
const sw = JSON.parse(readFileSync('/tmp/agent-swagger.json','utf8'))
|
||||
const routes = readFileSync('server/rest/routes.js','utf8')
|
||||
let miss = 0
|
||||
for (const [p, ops] of Object.entries(sw.paths)) {
|
||||
for (const m of Object.keys(ops)) {
|
||||
if (!['get','post','put'].includes(m)) continue
|
||||
const hit = routes.includes(\"'\"+p+\"'\") || routes.includes('\"'+p+'\"')
|
||||
if (!hit) { console.log('MISSING', m.toUpperCase(), p); miss++ }
|
||||
}
|
||||
}
|
||||
console.log('missing ops:', miss)
|
||||
"
|
||||
|
||||
# 3) Confirm every static chart is emitted
|
||||
# 2) Confirm every static chart is emitted
|
||||
node -e "
|
||||
import { readFileSync } from 'fs'
|
||||
import { STATIC_CHART_DEFS } from './shared/metrics.js'
|
||||
@@ -343,7 +326,7 @@ const missing = STATIC_CHART_DEFS.filter(d => !c.includes(d.id)).map(d => d.id)
|
||||
console.log(missing.length ? missing : 'all static charts referenced')
|
||||
"
|
||||
|
||||
# 4) Live smoke (agent running on :19999)
|
||||
# 3) Live smoke (agent running on :19999)
|
||||
curl -s http://127.0.0.1:19999/api/v1/charts | jq '.charts | keys | length'
|
||||
curl -s 'http://127.0.0.1:19999/api/v3/data?chart=system.cpu&after=-60&points=30' | jq '.labels,.points'
|
||||
curl -s 'http://127.0.0.1:19999/api/v3/allmetrics?format=prometheus' | head
|
||||
|
||||
Reference in New Issue
Block a user