postgresai 0.19.0-rc.2 → 0.19.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/postgres-ai.js +136 -11
- package/package.json +1 -1
- package/schemas/A014.schema.json +225 -0
- package/schemas/K003.schema.json +73 -3
- package/schemas/K004.schema.json +94 -5
package/dist/bin/postgres-ai.js
CHANGED
|
@@ -13538,7 +13538,7 @@ var {
|
|
|
13538
13538
|
// package.json
|
|
13539
13539
|
var package_default = {
|
|
13540
13540
|
name: "postgresai",
|
|
13541
|
-
version: "0.19.0-rc.
|
|
13541
|
+
version: "0.19.0-rc.4",
|
|
13542
13542
|
description: "postgres_ai CLI",
|
|
13543
13543
|
license: "Apache-2.0",
|
|
13544
13544
|
private: false,
|
|
@@ -16898,7 +16898,7 @@ var Result = import_lib.default.Result;
|
|
|
16898
16898
|
var TypeOverrides = import_lib.default.TypeOverrides;
|
|
16899
16899
|
var defaults = import_lib.default.defaults;
|
|
16900
16900
|
// package.json
|
|
16901
|
-
var version = "0.19.0-rc.
|
|
16901
|
+
var version = "0.19.0-rc.4";
|
|
16902
16902
|
var package_default2 = {
|
|
16903
16903
|
name: "postgresai",
|
|
16904
16904
|
version,
|
|
@@ -18138,6 +18138,12 @@ async function updateActionItem(params) {
|
|
|
18138
18138
|
}
|
|
18139
18139
|
|
|
18140
18140
|
// lib/reports.ts
|
|
18141
|
+
class ReportKindUnsupportedError extends Error {
|
|
18142
|
+
constructor() {
|
|
18143
|
+
super("--kind needs a newer PostgresAI API. Run without --kind to list all reports.");
|
|
18144
|
+
this.name = "ReportKindUnsupportedError";
|
|
18145
|
+
}
|
|
18146
|
+
}
|
|
18141
18147
|
function parseFlexibleDate(input) {
|
|
18142
18148
|
const s = input.trim();
|
|
18143
18149
|
const dotMatch = s.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})(?:\s+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/);
|
|
@@ -18161,7 +18167,7 @@ function parseFlexibleDate(input) {
|
|
|
18161
18167
|
throw new Error(`Unrecognized date format: ${input}. Use YYYY-MM-DD or DD.MM.YYYY`);
|
|
18162
18168
|
}
|
|
18163
18169
|
async function fetchReports(params) {
|
|
18164
|
-
const { apiKey, apiBaseUrl, orgScope, projectId, status, limit = 20, beforeDate, beforeId, debug } = params;
|
|
18170
|
+
const { apiKey, apiBaseUrl, orgScope, projectId, status, limit = 20, beforeDate, kind, beforeId, debug } = params;
|
|
18165
18171
|
if (!apiKey) {
|
|
18166
18172
|
throw new Error("API key is required");
|
|
18167
18173
|
}
|
|
@@ -18175,6 +18181,9 @@ async function fetchReports(params) {
|
|
|
18175
18181
|
if (status) {
|
|
18176
18182
|
url.searchParams.set("status", `eq.${status}`);
|
|
18177
18183
|
}
|
|
18184
|
+
if (kind) {
|
|
18185
|
+
url.searchParams.set("kind", `eq.${kind}`);
|
|
18186
|
+
}
|
|
18178
18187
|
if (beforeDate) {
|
|
18179
18188
|
url.searchParams.set("created_at", `lt.${beforeDate}`);
|
|
18180
18189
|
}
|
|
@@ -18202,9 +18211,22 @@ async function fetchReports(params) {
|
|
|
18202
18211
|
throw new Error(`Failed to parse reports response: ${data}`);
|
|
18203
18212
|
}
|
|
18204
18213
|
} else {
|
|
18214
|
+
if (kind && isMissingKindColumn(response.status, data)) {
|
|
18215
|
+
throw new ReportKindUnsupportedError;
|
|
18216
|
+
}
|
|
18205
18217
|
throw new Error(formatHttpError("Failed to fetch reports", response.status, data));
|
|
18206
18218
|
}
|
|
18207
18219
|
}
|
|
18220
|
+
function isMissingKindColumn(status, body) {
|
|
18221
|
+
if (status !== 400)
|
|
18222
|
+
return false;
|
|
18223
|
+
try {
|
|
18224
|
+
const err = JSON.parse(body);
|
|
18225
|
+
return err?.code === "42703" && typeof err?.message === "string" && /\bkind\b/.test(err.message);
|
|
18226
|
+
} catch {
|
|
18227
|
+
return false;
|
|
18228
|
+
}
|
|
18229
|
+
}
|
|
18208
18230
|
var MAX_ALL_REPORTS = 1e4;
|
|
18209
18231
|
async function fetchAllReports(params) {
|
|
18210
18232
|
const pageSize = params.limit ?? 100;
|
|
@@ -33141,6 +33163,12 @@ async function updateActionItem2(params) {
|
|
|
33141
33163
|
}
|
|
33142
33164
|
|
|
33143
33165
|
// lib/reports.ts
|
|
33166
|
+
class ReportKindUnsupportedError2 extends Error {
|
|
33167
|
+
constructor() {
|
|
33168
|
+
super("--kind needs a newer PostgresAI API. Run without --kind to list all reports.");
|
|
33169
|
+
this.name = "ReportKindUnsupportedError";
|
|
33170
|
+
}
|
|
33171
|
+
}
|
|
33144
33172
|
function parseFlexibleDate2(input) {
|
|
33145
33173
|
const s = input.trim();
|
|
33146
33174
|
const dotMatch = s.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})(?:\s+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/);
|
|
@@ -33164,7 +33192,7 @@ function parseFlexibleDate2(input) {
|
|
|
33164
33192
|
throw new Error(`Unrecognized date format: ${input}. Use YYYY-MM-DD or DD.MM.YYYY`);
|
|
33165
33193
|
}
|
|
33166
33194
|
async function fetchReports2(params) {
|
|
33167
|
-
const { apiKey, apiBaseUrl, orgScope, projectId, status, limit = 20, beforeDate, beforeId, debug } = params;
|
|
33195
|
+
const { apiKey, apiBaseUrl, orgScope, projectId, status, limit = 20, beforeDate, kind, beforeId, debug } = params;
|
|
33168
33196
|
if (!apiKey) {
|
|
33169
33197
|
throw new Error("API key is required");
|
|
33170
33198
|
}
|
|
@@ -33178,6 +33206,9 @@ async function fetchReports2(params) {
|
|
|
33178
33206
|
if (status) {
|
|
33179
33207
|
url.searchParams.set("status", `eq.${status}`);
|
|
33180
33208
|
}
|
|
33209
|
+
if (kind) {
|
|
33210
|
+
url.searchParams.set("kind", `eq.${kind}`);
|
|
33211
|
+
}
|
|
33181
33212
|
if (beforeDate) {
|
|
33182
33213
|
url.searchParams.set("created_at", `lt.${beforeDate}`);
|
|
33183
33214
|
}
|
|
@@ -33205,9 +33236,94 @@ async function fetchReports2(params) {
|
|
|
33205
33236
|
throw new Error(`Failed to parse reports response: ${data}`);
|
|
33206
33237
|
}
|
|
33207
33238
|
} else {
|
|
33239
|
+
if (kind && isMissingKindColumn2(response.status, data)) {
|
|
33240
|
+
throw new ReportKindUnsupportedError2;
|
|
33241
|
+
}
|
|
33208
33242
|
throw new Error(formatHttpError("Failed to fetch reports", response.status, data));
|
|
33209
33243
|
}
|
|
33210
33244
|
}
|
|
33245
|
+
function isMissingKindColumn2(status, body) {
|
|
33246
|
+
if (status !== 400)
|
|
33247
|
+
return false;
|
|
33248
|
+
try {
|
|
33249
|
+
const err = JSON.parse(body);
|
|
33250
|
+
return err?.code === "42703" && typeof err?.message === "string" && /\bkind\b/.test(err.message);
|
|
33251
|
+
} catch {
|
|
33252
|
+
return false;
|
|
33253
|
+
}
|
|
33254
|
+
}
|
|
33255
|
+
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
33256
|
+
var pad2 = (n) => String(n).padStart(2, "0");
|
|
33257
|
+
function isoWeek(date) {
|
|
33258
|
+
const d = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
|
|
33259
|
+
d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
|
|
33260
|
+
const jan1 = Date.UTC(d.getUTCFullYear(), 0, 1);
|
|
33261
|
+
const week = Math.floor((d.getTime() - jan1) / 86400000 / 7) + 1;
|
|
33262
|
+
return `${d.getUTCFullYear()}-W${pad2(week)}`;
|
|
33263
|
+
}
|
|
33264
|
+
function periodEnd(start, period) {
|
|
33265
|
+
const end = new Date(start);
|
|
33266
|
+
if (period === "day")
|
|
33267
|
+
end.setUTCDate(end.getUTCDate() + 1);
|
|
33268
|
+
else if (period === "week")
|
|
33269
|
+
end.setUTCDate(end.getUTCDate() + 7);
|
|
33270
|
+
else
|
|
33271
|
+
end.setUTCMonth(end.getUTCMonth() + 1);
|
|
33272
|
+
return end;
|
|
33273
|
+
}
|
|
33274
|
+
function periodText(start, period) {
|
|
33275
|
+
const ym = `${start.getUTCFullYear()}-${pad2(start.getUTCMonth() + 1)}`;
|
|
33276
|
+
if (period === "month")
|
|
33277
|
+
return ym;
|
|
33278
|
+
if (period === "day")
|
|
33279
|
+
return `${ym}-${pad2(start.getUTCDate())}`;
|
|
33280
|
+
const last = new Date(start);
|
|
33281
|
+
last.setUTCDate(last.getUTCDate() + 6);
|
|
33282
|
+
const to = last.getUTCMonth() === start.getUTCMonth() ? String(last.getUTCDate()) : `${MONTHS[last.getUTCMonth()]} ${last.getUTCDate()}`;
|
|
33283
|
+
return `${isoWeek(start)} (${MONTHS[start.getUTCMonth()]} ${start.getUTCDate()}–${to})`;
|
|
33284
|
+
}
|
|
33285
|
+
function reportTypeLabel(report, now = new Date) {
|
|
33286
|
+
if (report.kind === "checkup")
|
|
33287
|
+
return "Checkup";
|
|
33288
|
+
if (report.kind !== "health")
|
|
33289
|
+
return null;
|
|
33290
|
+
const period = report.health_period;
|
|
33291
|
+
const start = report.health_period_start ? new Date(report.health_period_start) : null;
|
|
33292
|
+
if (period !== "day" && period !== "week" && period !== "month")
|
|
33293
|
+
return "Database health";
|
|
33294
|
+
if (!start || Number.isNaN(start.getTime()))
|
|
33295
|
+
return "Database health";
|
|
33296
|
+
const inProgress = now.getTime() < periodEnd(start, period).getTime();
|
|
33297
|
+
return `Database health · ${period} ${periodText(start, period)}${inProgress ? " (in progress)" : ""}`;
|
|
33298
|
+
}
|
|
33299
|
+
function plain(value) {
|
|
33300
|
+
return String(value).replace(/[\r\n\t]+/g, " ").replace(/[\u0000-\u001f\u007f-\u009f]/g, "");
|
|
33301
|
+
}
|
|
33302
|
+
function utcText(value) {
|
|
33303
|
+
const d = new Date(value);
|
|
33304
|
+
if (Number.isNaN(d.getTime()))
|
|
33305
|
+
return value;
|
|
33306
|
+
return `${d.toISOString().slice(0, 10)} ${d.toISOString().slice(11, 19)} UTC`;
|
|
33307
|
+
}
|
|
33308
|
+
function formatReportsForTerminal(reports, now = new Date) {
|
|
33309
|
+
if (reports.length === 0)
|
|
33310
|
+
return "No reports.";
|
|
33311
|
+
return reports.map((r) => {
|
|
33312
|
+
const lines = [`- id: ${r.id}`, ` project: ${plain(r.project_name ?? r.project_id)}`];
|
|
33313
|
+
const type = reportTypeLabel(r, now);
|
|
33314
|
+
if (type)
|
|
33315
|
+
lines.push(` type: ${type}`);
|
|
33316
|
+
lines.push(` created: ${plain(utcText(r.display_at || r.created_at))}`);
|
|
33317
|
+
if (r.status)
|
|
33318
|
+
lines.push(` status: ${plain(r.status)}`);
|
|
33319
|
+
if (r.status_reason)
|
|
33320
|
+
lines.push(` status_reason: ${plain(r.status_reason)}`);
|
|
33321
|
+
return lines.join(`
|
|
33322
|
+
`);
|
|
33323
|
+
}).join(`
|
|
33324
|
+
|
|
33325
|
+
`);
|
|
33326
|
+
}
|
|
33211
33327
|
var MAX_ALL_REPORTS2 = 1e4;
|
|
33212
33328
|
async function fetchAllReports2(params) {
|
|
33213
33329
|
const pageSize = params.limit ?? 100;
|
|
@@ -43444,7 +43560,7 @@ function summarizeG003(nodeData) {
|
|
|
43444
43560
|
|
|
43445
43561
|
// lib/checkup.ts
|
|
43446
43562
|
var __dirname = "/builds/postgres-ai/postgresai/cli/lib";
|
|
43447
|
-
var CONTRACT_VERSION = "1.
|
|
43563
|
+
var CONTRACT_VERSION = "1.1.0";
|
|
43448
43564
|
var SECONDS_PER_DAY = 86400;
|
|
43449
43565
|
var SECONDS_PER_HOUR = 3600;
|
|
43450
43566
|
var SECONDS_PER_MINUTE = 60;
|
|
@@ -44429,8 +44545,11 @@ select (count(*) filter (where auth_method = 'cert'))::int as cert,
|
|
|
44429
44545
|
from pg_hba_file_rules
|
|
44430
44546
|
`;
|
|
44431
44547
|
function a005Error(err) {
|
|
44432
|
-
const
|
|
44433
|
-
|
|
44548
|
+
const chars = Array.from((err instanceof Error ? err.message : String(err)).replace(/\s+/g, " ").trim());
|
|
44549
|
+
if (chars.length <= A005_ERROR_CHARS)
|
|
44550
|
+
return chars.join("") || "unknown error";
|
|
44551
|
+
const head = Math.floor((A005_ERROR_CHARS - 3) / 3);
|
|
44552
|
+
return chars.slice(0, head).join("") + "..." + chars.slice(chars.length - (A005_ERROR_CHARS - 3 - head)).join("");
|
|
44434
44553
|
}
|
|
44435
44554
|
var a005OpenDatabase = async (client, database) => {
|
|
44436
44555
|
const params = client.connectionParameters;
|
|
@@ -53291,11 +53410,11 @@ withOrgOptions(issues.command("update-action-item <actionItemId>")).description(
|
|
|
53291
53410
|
process.exitCode = 1;
|
|
53292
53411
|
}
|
|
53293
53412
|
});
|
|
53294
|
-
var reports = program2.command("reports").description("checkup reports
|
|
53295
|
-
withOrgOptions(reports.command("list")).description("list checkup reports").option("--project-id <id>", "filter by project id", (v) => parseInt(v, 10)).addOption(new Option2("--status <status>", "filter by status (e.g., completed)").hideHelp()).option("--limit <n>", "max number of reports to return (default: 20, max: 100)", (v) => {
|
|
53413
|
+
var reports = program2.command("reports").description("checkup reports and Database health collections");
|
|
53414
|
+
withOrgOptions(reports.command("list")).description("list checkup reports and Database health collections, most recently added first").option("--project-id <id>", "filter by project id", (v) => parseInt(v, 10)).addOption(new Option2("--kind <kind>", "only checkup reports or only Database health collections").choices(["checkup", "health"])).addOption(new Option2("--status <status>", "filter by status (e.g., completed; Database health collections have none)").hideHelp()).option("--limit <n>", "max number of reports to return (default: 20, max: 100)", (v) => {
|
|
53296
53415
|
const n = parseInt(v, 10);
|
|
53297
53416
|
return Number.isNaN(n) ? 20 : Math.max(1, Math.min(n, 100));
|
|
53298
|
-
}).option("--before <date>", "show reports
|
|
53417
|
+
}).option("--before <date>", "show reports from before this date; a Database health collection counts by its period, not by the time shown (YYYY-MM-DD, DD.MM.YYYY, etc.)").option("--all", "fetch all reports (paginated automatically)").addOption(new Option2("--debug", "enable debug output").hideHelp()).option("--json", "output raw JSON").action(async (opts) => {
|
|
53299
53418
|
const spinner = createTtySpinner(process.stdout.isTTY ?? false, "Fetching reports...");
|
|
53300
53419
|
try {
|
|
53301
53420
|
const rootOpts = program2.opts();
|
|
@@ -53321,6 +53440,7 @@ withOrgOptions(reports.command("list")).description("list checkup reports").opti
|
|
|
53321
53440
|
apiBaseUrl,
|
|
53322
53441
|
projectId: opts.projectId,
|
|
53323
53442
|
status: opts.status,
|
|
53443
|
+
kind: opts.kind,
|
|
53324
53444
|
limit: opts.limit,
|
|
53325
53445
|
debug: !!opts.debug
|
|
53326
53446
|
});
|
|
@@ -53330,13 +53450,18 @@ withOrgOptions(reports.command("list")).description("list checkup reports").opti
|
|
|
53330
53450
|
apiBaseUrl,
|
|
53331
53451
|
projectId: opts.projectId,
|
|
53332
53452
|
status: opts.status,
|
|
53453
|
+
kind: opts.kind,
|
|
53333
53454
|
limit: opts.limit,
|
|
53334
53455
|
beforeDate: opts.before ? parseFlexibleDate2(opts.before) : undefined,
|
|
53335
53456
|
debug: !!opts.debug
|
|
53336
53457
|
});
|
|
53337
53458
|
}
|
|
53338
53459
|
spinner.stop();
|
|
53339
|
-
|
|
53460
|
+
if (!opts.json && process.stdout.isTTY) {
|
|
53461
|
+
console.log(formatReportsForTerminal(result));
|
|
53462
|
+
} else {
|
|
53463
|
+
printResult(result, opts.json);
|
|
53464
|
+
}
|
|
53340
53465
|
} catch (err) {
|
|
53341
53466
|
spinner.stop();
|
|
53342
53467
|
const message = err instanceof Error ? err.message : String(err);
|
package/package.json
CHANGED
package/schemas/A014.schema.json
CHANGED
|
@@ -186,6 +186,13 @@
|
|
|
186
186
|
"number",
|
|
187
187
|
"null"
|
|
188
188
|
]
|
|
189
|
+
},
|
|
190
|
+
"avg_pct": {
|
|
191
|
+
"type": [
|
|
192
|
+
"number",
|
|
193
|
+
"null"
|
|
194
|
+
],
|
|
195
|
+
"description": "Mean of the 5-minute CPU averages (a burstable class's baseline is an average)."
|
|
189
196
|
}
|
|
190
197
|
}
|
|
191
198
|
},
|
|
@@ -367,6 +374,224 @@
|
|
|
367
374
|
"avg_5m"
|
|
368
375
|
],
|
|
369
376
|
"description": "What a disk_iops point is: avg_5m = the 5-minute average. Reports from older reporters omit it (their points were the busiest minute), and the platform does not judge their IOPS."
|
|
377
|
+
},
|
|
378
|
+
"cpu_avg_pct": {
|
|
379
|
+
"type": "array",
|
|
380
|
+
"items": {
|
|
381
|
+
"type": [
|
|
382
|
+
"number",
|
|
383
|
+
"null"
|
|
384
|
+
]
|
|
385
|
+
},
|
|
386
|
+
"description": "5-minute CPU averages, percent"
|
|
387
|
+
},
|
|
388
|
+
"mem_available_bytes": {
|
|
389
|
+
"type": "array",
|
|
390
|
+
"items": {
|
|
391
|
+
"type": [
|
|
392
|
+
"number",
|
|
393
|
+
"null"
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
"description": "Lowest memory available in each 5 minutes, bytes"
|
|
397
|
+
},
|
|
398
|
+
"cpu_credit_balance": {
|
|
399
|
+
"type": "array",
|
|
400
|
+
"items": {
|
|
401
|
+
"type": [
|
|
402
|
+
"number",
|
|
403
|
+
"null"
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
"description": "Lowest CPU credit balance in each 5 minutes (RDS db.t*)"
|
|
407
|
+
},
|
|
408
|
+
"cpu_surplus_balance": {
|
|
409
|
+
"type": "array",
|
|
410
|
+
"items": {
|
|
411
|
+
"type": [
|
|
412
|
+
"number",
|
|
413
|
+
"null"
|
|
414
|
+
]
|
|
415
|
+
},
|
|
416
|
+
"description": "Highest CPU surplus credit balance in each 5 minutes (RDS db.t*)"
|
|
417
|
+
},
|
|
418
|
+
"burst_balance_pct": {
|
|
419
|
+
"type": "array",
|
|
420
|
+
"items": {
|
|
421
|
+
"type": [
|
|
422
|
+
"number",
|
|
423
|
+
"null"
|
|
424
|
+
]
|
|
425
|
+
},
|
|
426
|
+
"description": "Lowest gp2 BurstBalance in each 5 minutes, percent"
|
|
427
|
+
},
|
|
428
|
+
"ebs_io_balance_pct": {
|
|
429
|
+
"type": "array",
|
|
430
|
+
"items": {
|
|
431
|
+
"type": [
|
|
432
|
+
"number",
|
|
433
|
+
"null"
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
"description": "Lowest EBSIOBalance% in each 5 minutes"
|
|
437
|
+
},
|
|
438
|
+
"ebs_byte_balance_pct": {
|
|
439
|
+
"type": "array",
|
|
440
|
+
"items": {
|
|
441
|
+
"type": [
|
|
442
|
+
"number",
|
|
443
|
+
"null"
|
|
444
|
+
]
|
|
445
|
+
},
|
|
446
|
+
"description": "Lowest EBSByteBalance% in each 5 minutes"
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"observed_size": {
|
|
451
|
+
"type": "object",
|
|
452
|
+
"additionalProperties": false,
|
|
453
|
+
"description": "What the database server is, for the platform's sizing (platform-all#1101). Absent when unknown.",
|
|
454
|
+
"required": [
|
|
455
|
+
"provider",
|
|
456
|
+
"size",
|
|
457
|
+
"region",
|
|
458
|
+
"storage",
|
|
459
|
+
"seen_at_epoch",
|
|
460
|
+
"since_epoch"
|
|
461
|
+
],
|
|
462
|
+
"properties": {
|
|
463
|
+
"provider": {
|
|
464
|
+
"enum": [
|
|
465
|
+
"rds",
|
|
466
|
+
"aurora",
|
|
467
|
+
"clickhouse"
|
|
468
|
+
],
|
|
469
|
+
"description": "Where the server runs: rds and aurora from rds-host-stats' instance info, clickhouse for a ClickHouse Managed Postgres service."
|
|
470
|
+
},
|
|
471
|
+
"size": {
|
|
472
|
+
"type": [
|
|
473
|
+
"string",
|
|
474
|
+
"null"
|
|
475
|
+
],
|
|
476
|
+
"description": "RDS/Aurora: the instance class (db.t4g.micro). ClickHouse: the service size from the ClickHouse Cloud API (r6gd.large); null when only its metrics are known."
|
|
477
|
+
},
|
|
478
|
+
"region": {
|
|
479
|
+
"type": [
|
|
480
|
+
"string",
|
|
481
|
+
"null"
|
|
482
|
+
],
|
|
483
|
+
"description": "Cloud region (eu-central-1); null when unknown."
|
|
484
|
+
},
|
|
485
|
+
"engine": {
|
|
486
|
+
"type": [
|
|
487
|
+
"string",
|
|
488
|
+
"null"
|
|
489
|
+
],
|
|
490
|
+
"description": "RDS/Aurora only: the DB engine (postgres, aurora-postgresql)."
|
|
491
|
+
},
|
|
492
|
+
"multi_az": {
|
|
493
|
+
"type": [
|
|
494
|
+
"boolean",
|
|
495
|
+
"null"
|
|
496
|
+
],
|
|
497
|
+
"description": "RDS only: whether the instance is a Multi-AZ deployment (its compute is paid twice)."
|
|
498
|
+
},
|
|
499
|
+
"standbys": {
|
|
500
|
+
"type": [
|
|
501
|
+
"integer",
|
|
502
|
+
"null"
|
|
503
|
+
],
|
|
504
|
+
"description": "ClickHouse only: standby copies from the API's haType (none 0, async 1, sync 2)."
|
|
505
|
+
},
|
|
506
|
+
"org_tier": {
|
|
507
|
+
"type": [
|
|
508
|
+
"string",
|
|
509
|
+
"null"
|
|
510
|
+
],
|
|
511
|
+
"description": "ClickHouse only: the organization's plan (basic, scale, enterprise), lower case; it prices the size. Null when not read."
|
|
512
|
+
},
|
|
513
|
+
"vcpus": {
|
|
514
|
+
"type": [
|
|
515
|
+
"integer",
|
|
516
|
+
"null"
|
|
517
|
+
],
|
|
518
|
+
"description": "ClickHouse only: vCPUs from the service's metrics (PostgresServer_CPUCores)."
|
|
519
|
+
},
|
|
520
|
+
"memory_bytes": {
|
|
521
|
+
"type": [
|
|
522
|
+
"integer",
|
|
523
|
+
"null"
|
|
524
|
+
],
|
|
525
|
+
"description": "ClickHouse only: memory from the service's metrics, in bytes."
|
|
526
|
+
},
|
|
527
|
+
"size_source": {
|
|
528
|
+
"enum": [
|
|
529
|
+
"api",
|
|
530
|
+
"metrics"
|
|
531
|
+
],
|
|
532
|
+
"description": "ClickHouse only: api when the size came from the ClickHouse Cloud API, metrics when only the metrics answered."
|
|
533
|
+
},
|
|
534
|
+
"storage": {
|
|
535
|
+
"type": "object",
|
|
536
|
+
"additionalProperties": false,
|
|
537
|
+
"required": [
|
|
538
|
+
"type",
|
|
539
|
+
"size_gb",
|
|
540
|
+
"max_size_gb",
|
|
541
|
+
"iops",
|
|
542
|
+
"throughput_mbps"
|
|
543
|
+
],
|
|
544
|
+
"properties": {
|
|
545
|
+
"type": {
|
|
546
|
+
"type": [
|
|
547
|
+
"string",
|
|
548
|
+
"null"
|
|
549
|
+
],
|
|
550
|
+
"description": "Volume type (gp2, gp3, io1, io2; nvme for ClickHouse)."
|
|
551
|
+
},
|
|
552
|
+
"size_gb": {
|
|
553
|
+
"type": [
|
|
554
|
+
"number",
|
|
555
|
+
"null"
|
|
556
|
+
],
|
|
557
|
+
"description": "Allocated storage in GiB."
|
|
558
|
+
},
|
|
559
|
+
"max_size_gb": {
|
|
560
|
+
"type": [
|
|
561
|
+
"number",
|
|
562
|
+
"null"
|
|
563
|
+
],
|
|
564
|
+
"description": "RDS storage autoscaling ceiling in GiB; null when autoscaling is off."
|
|
565
|
+
},
|
|
566
|
+
"iops": {
|
|
567
|
+
"type": [
|
|
568
|
+
"integer",
|
|
569
|
+
"null"
|
|
570
|
+
],
|
|
571
|
+
"description": "Provisioned IOPS (RDS gp3/io1/io2); null otherwise."
|
|
572
|
+
},
|
|
573
|
+
"throughput_mbps": {
|
|
574
|
+
"type": [
|
|
575
|
+
"number",
|
|
576
|
+
"null"
|
|
577
|
+
],
|
|
578
|
+
"description": "Provisioned throughput in MB/s (decimal: 125 MiB/s is 131.1), as the platform shows it; null otherwise."
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
"seen_at_epoch": {
|
|
583
|
+
"type": [
|
|
584
|
+
"integer",
|
|
585
|
+
"null"
|
|
586
|
+
],
|
|
587
|
+
"description": "Unix seconds of the last sample that showed this size. The platform treats a size seen more than an hour before (or after) the report as stale."
|
|
588
|
+
},
|
|
589
|
+
"since_epoch": {
|
|
590
|
+
"type": [
|
|
591
|
+
"integer",
|
|
592
|
+
"null"
|
|
593
|
+
],
|
|
594
|
+
"description": "Unix seconds of the first point of the current size after another one in the 7-day window (a resize); null when the size did not change."
|
|
370
595
|
}
|
|
371
596
|
}
|
|
372
597
|
}
|
package/schemas/K003.schema.json
CHANGED
|
@@ -144,9 +144,81 @@
|
|
|
144
144
|
"summary": { "$ref": "#/$defs/summary" }
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
|
+
"hourlyNumbers": { "type": "array", "items": { "type": "number" } },
|
|
148
|
+
"hourlyQueryEntry": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"additionalProperties": false,
|
|
151
|
+
"required": ["queryid", "total_time_ms", "total_exec_time_ms", "total_plan_time_ms", "hourly_time_ms", "hourly_exec_time_ms", "hourly_plan_time_ms"],
|
|
152
|
+
"properties": {
|
|
153
|
+
"queryid": { "type": "string" },
|
|
154
|
+
"total_time_ms": { "type": "number" },
|
|
155
|
+
"total_exec_time_ms": { "type": "number" },
|
|
156
|
+
"total_plan_time_ms": { "type": "number" },
|
|
157
|
+
"hourly_time_ms": { "$ref": "#/$defs/hourlyNumbers" },
|
|
158
|
+
"hourly_exec_time_ms": { "$ref": "#/$defs/hourlyNumbers" },
|
|
159
|
+
"hourly_plan_time_ms": { "type": ["array", "null"], "items": { "type": "number" } },
|
|
160
|
+
"calls": { "type": "number" },
|
|
161
|
+
"rows": { "type": "number" },
|
|
162
|
+
"shared_blks_hit_bytes": { "type": "number" },
|
|
163
|
+
"shared_blks_read_bytes": { "type": "number" },
|
|
164
|
+
"wal_bytes": { "type": "number" },
|
|
165
|
+
"temp_bytes_written": { "type": "number" },
|
|
166
|
+
"query_text": { "type": "string" },
|
|
167
|
+
"is_monitoring": { "type": "boolean" },
|
|
168
|
+
"relations": { "type": "array", "items": { "type": "string" }, "maxItems": 3 }
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"exportRule": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"additionalProperties": false,
|
|
174
|
+
"required": ["top_n_per_database", "ranked_by", "min_calls", "min_exec_time_ms", "interval_seconds"],
|
|
175
|
+
"properties": {
|
|
176
|
+
"top_n_per_database": { "type": "integer" },
|
|
177
|
+
"ranked_by": { "type": "string" },
|
|
178
|
+
"min_calls": { "type": "integer" },
|
|
179
|
+
"min_exec_time_ms": { "type": "number" },
|
|
180
|
+
"interval_seconds": { "type": "integer" }
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"hourlySummary": {
|
|
184
|
+
"type": "object",
|
|
185
|
+
"additionalProperties": false,
|
|
186
|
+
"required": ["queries_returned", "total_time_ms", "total_time_tracked_queries_ms", "total_time_other_ms", "time_range_hours", "hourly_timestamps", "limit", "plan_time_available", "note"],
|
|
187
|
+
"properties": {
|
|
188
|
+
"queries_returned": { "type": "integer" },
|
|
189
|
+
"total_time_ms": { "type": "number" },
|
|
190
|
+
"total_time_tracked_queries_ms": { "type": "number" },
|
|
191
|
+
"total_time_other_ms": { "type": "number" },
|
|
192
|
+
"time_range_hours": { "type": "integer" },
|
|
193
|
+
"hourly_timestamps": { "type": "array", "items": { "type": "integer" } },
|
|
194
|
+
"limit": { "type": "integer" },
|
|
195
|
+
"plan_time_available": { "type": "boolean" },
|
|
196
|
+
"note": { "type": "string" },
|
|
197
|
+
"window_start": { "type": "string" },
|
|
198
|
+
"window_end": { "type": "string" },
|
|
199
|
+
"window_seconds": { "type": "integer" },
|
|
200
|
+
"export_rule": { "$ref": "#/$defs/exportRule" },
|
|
201
|
+
"total_calls": { "type": "number" },
|
|
202
|
+
"statements_exported_max": { "type": "integer" },
|
|
203
|
+
"statements_reset_max": { "type": "integer" },
|
|
204
|
+
"statements_reset_at": { "type": "string" }
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"hourlyDbEntry": {
|
|
208
|
+
"type": "object",
|
|
209
|
+
"additionalProperties": false,
|
|
210
|
+
"required": ["top_queries", "other_time_hourly", "other_exec_time_hourly", "other_plan_time_hourly", "summary"],
|
|
211
|
+
"properties": {
|
|
212
|
+
"top_queries": { "type": "array", "items": { "$ref": "#/$defs/hourlyQueryEntry" } },
|
|
213
|
+
"other_time_hourly": { "$ref": "#/$defs/hourlyNumbers" },
|
|
214
|
+
"other_exec_time_hourly": { "$ref": "#/$defs/hourlyNumbers" },
|
|
215
|
+
"other_plan_time_hourly": { "type": ["array", "null"], "items": { "type": "number" } },
|
|
216
|
+
"summary": { "$ref": "#/$defs/hourlySummary" }
|
|
217
|
+
}
|
|
218
|
+
},
|
|
147
219
|
"data": {
|
|
148
220
|
"type": "object",
|
|
149
|
-
"additionalProperties": { "$ref": "#/$defs/dbEntry" }
|
|
221
|
+
"additionalProperties": { "anyOf": [{ "$ref": "#/$defs/hourlyDbEntry" }, { "$ref": "#/$defs/dbEntry" }] }
|
|
150
222
|
},
|
|
151
223
|
"nodeResult": {
|
|
152
224
|
"type": "object",
|
|
@@ -159,5 +231,3 @@
|
|
|
159
231
|
}
|
|
160
232
|
}
|
|
161
233
|
}
|
|
162
|
-
|
|
163
|
-
|
package/schemas/K004.schema.json
CHANGED
|
@@ -56,7 +56,65 @@
|
|
|
56
56
|
"properties": {
|
|
57
57
|
"queryid": { "type": "string" },
|
|
58
58
|
"total_temp_bytes": { "type": "number" },
|
|
59
|
-
"hourly_temp_bytes": { "$ref": "#/$defs/hourlyNumbers" }
|
|
59
|
+
"hourly_temp_bytes": { "$ref": "#/$defs/hourlyNumbers" },
|
|
60
|
+
"calls": { "type": "number" },
|
|
61
|
+
"exec_time_ms": { "type": "number" },
|
|
62
|
+
"rows": { "type": "number" },
|
|
63
|
+
"shared_blks_hit_bytes": { "type": "number" },
|
|
64
|
+
"shared_blks_read_bytes": { "type": "number" },
|
|
65
|
+
"wal_bytes": { "type": "number" },
|
|
66
|
+
"temp_bytes_written": { "type": "number" },
|
|
67
|
+
"temp_bytes_read": { "type": "number" },
|
|
68
|
+
"query_text": { "type": "string" },
|
|
69
|
+
"is_monitoring": { "type": "boolean" },
|
|
70
|
+
"relations": { "type": "array", "items": { "type": "string" }, "maxItems": 3 }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"exportRule": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"required": ["top_n_per_database", "ranked_by", "min_calls", "min_exec_time_ms", "interval_seconds"],
|
|
77
|
+
"properties": {
|
|
78
|
+
"top_n_per_database": { "type": "integer" },
|
|
79
|
+
"ranked_by": { "type": "string" },
|
|
80
|
+
"min_calls": { "type": "integer" },
|
|
81
|
+
"min_exec_time_ms": { "type": "number" },
|
|
82
|
+
"interval_seconds": { "type": "integer" }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"counterHours": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"additionalProperties": false,
|
|
88
|
+
"required": ["start", "end", "total", "hourly"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"start": { "type": "string" },
|
|
91
|
+
"end": { "type": "string" },
|
|
92
|
+
"total": { "type": "number" },
|
|
93
|
+
"hourly": { "$ref": "#/$defs/hourlyNumbers" },
|
|
94
|
+
"peak_per_s": { "type": "number" },
|
|
95
|
+
"peak_at": { "type": "string" }
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"setting": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"required": ["setting", "unit", "context"],
|
|
102
|
+
"properties": {
|
|
103
|
+
"setting": { "type": "string" },
|
|
104
|
+
"unit": { "type": "string" },
|
|
105
|
+
"context": { "type": "string" }
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"override": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"additionalProperties": false,
|
|
111
|
+
"required": ["scope", "role", "database", "setting", "value"],
|
|
112
|
+
"properties": {
|
|
113
|
+
"scope": { "type": "string" },
|
|
114
|
+
"role": { "type": ["string", "null"] },
|
|
115
|
+
"database": { "type": ["string", "null"] },
|
|
116
|
+
"setting": { "type": "string" },
|
|
117
|
+
"value": { "type": "string" }
|
|
60
118
|
}
|
|
61
119
|
},
|
|
62
120
|
"summary": {
|
|
@@ -78,7 +136,25 @@
|
|
|
78
136
|
"total_temp_bytes_other": { "type": "number" },
|
|
79
137
|
"time_range_hours": { "type": "integer" },
|
|
80
138
|
"hourly_timestamps": { "$ref": "#/$defs/timeline" },
|
|
81
|
-
"limit": { "type": "integer" }
|
|
139
|
+
"limit": { "type": "integer" },
|
|
140
|
+
"window_start": { "type": "string" },
|
|
141
|
+
"window_end": { "type": "string" },
|
|
142
|
+
"window_seconds": { "type": "integer" },
|
|
143
|
+
"export_rule": { "$ref": "#/$defs/exportRule" },
|
|
144
|
+
"total_calls": { "type": "number" },
|
|
145
|
+
"statements_exported_max": { "type": "integer" },
|
|
146
|
+
"statements_reset_max": { "type": "integer" },
|
|
147
|
+
"statements_reset_at": { "type": "string" },
|
|
148
|
+
"database_temp": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"additionalProperties": false,
|
|
151
|
+
"properties": {
|
|
152
|
+
"bytes": { "$ref": "#/$defs/counterHours" },
|
|
153
|
+
"files": { "$ref": "#/$defs/counterHours" },
|
|
154
|
+
"bytes_error": { "type": "string" },
|
|
155
|
+
"files_error": { "type": "string" }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
82
158
|
}
|
|
83
159
|
},
|
|
84
160
|
"dbEntry": {
|
|
@@ -101,10 +177,23 @@
|
|
|
101
177
|
"required": ["data"],
|
|
102
178
|
"properties": {
|
|
103
179
|
"data": { "$ref": "#/$defs/data" },
|
|
104
|
-
"postgres_version": { "$ref": "#/$defs/postgresVersion" }
|
|
180
|
+
"postgres_version": { "$ref": "#/$defs/postgresVersion" },
|
|
181
|
+
"settings": { "type": "object", "additionalProperties": { "$ref": "#/$defs/setting" } },
|
|
182
|
+
"settings_error": { "type": "string" },
|
|
183
|
+
"overrides": {
|
|
184
|
+
"type": "object",
|
|
185
|
+
"additionalProperties": false,
|
|
186
|
+
"required": ["rows_read", "values"],
|
|
187
|
+
"properties": {
|
|
188
|
+
"rows_read": { "type": "integer" },
|
|
189
|
+
"values": { "type": "array", "items": { "$ref": "#/$defs/override" } }
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"overrides_error": { "type": "string" },
|
|
193
|
+
"node_error": { "type": "string" },
|
|
194
|
+
"platform_allowed": { "type": "array", "items": { "type": "string" } },
|
|
195
|
+
"platform_allowed_error": { "type": "string" }
|
|
105
196
|
}
|
|
106
197
|
}
|
|
107
198
|
}
|
|
108
199
|
}
|
|
109
|
-
|
|
110
|
-
|