postgresai 0.16.0-rc.4 → 0.16.0

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.
Files changed (85) hide show
  1. package/README.md +154 -0
  2. package/dist/bin/postgres-ai.js +2911 -255
  3. package/package.json +12 -3
  4. package/schemas/A002.schema.json +63 -0
  5. package/schemas/A003.schema.json +73 -0
  6. package/schemas/A004.schema.json +81 -0
  7. package/schemas/A007.schema.json +71 -0
  8. package/schemas/A013.schema.json +61 -0
  9. package/schemas/D001.schema.json +71 -0
  10. package/schemas/D004.schema.json +136 -0
  11. package/schemas/F001.schema.json +73 -0
  12. package/schemas/F002.schema.json +108 -0
  13. package/schemas/F003.schema.json +138 -0
  14. package/schemas/F004.schema.json +125 -0
  15. package/schemas/F005.schema.json +131 -0
  16. package/schemas/F009.schema.json +155 -0
  17. package/schemas/G001.schema.json +135 -0
  18. package/schemas/G003.schema.json +90 -0
  19. package/schemas/H001.schema.json +141 -0
  20. package/schemas/H002.schema.json +129 -0
  21. package/schemas/H004.schema.json +128 -0
  22. package/schemas/I001.schema.json +149 -0
  23. package/schemas/K001.schema.json +161 -0
  24. package/schemas/K003.schema.json +163 -0
  25. package/schemas/K004.schema.json +110 -0
  26. package/schemas/K005.schema.json +110 -0
  27. package/schemas/K006.schema.json +110 -0
  28. package/schemas/K007.schema.json +110 -0
  29. package/schemas/K008.schema.json +110 -0
  30. package/schemas/M001.schema.json +119 -0
  31. package/schemas/M002.schema.json +110 -0
  32. package/schemas/M003.schema.json +128 -0
  33. package/schemas/N001.schema.json +161 -0
  34. package/schemas/query.schema.json +62 -0
  35. package/CHANGELOG.md +0 -11
  36. package/bin/postgres-ai.ts +0 -5578
  37. package/bun.lock +0 -258
  38. package/bunfig.toml +0 -20
  39. package/lib/aas-onboard.ts +0 -251
  40. package/lib/auth-server.ts +0 -285
  41. package/lib/checkup-api.ts +0 -526
  42. package/lib/checkup-dictionary.ts +0 -103
  43. package/lib/checkup-summary.ts +0 -338
  44. package/lib/checkup.ts +0 -2261
  45. package/lib/config.ts +0 -171
  46. package/lib/init.ts +0 -1152
  47. package/lib/instances.ts +0 -245
  48. package/lib/issues.ts +0 -1060
  49. package/lib/mcp-server.ts +0 -667
  50. package/lib/metrics-loader.ts +0 -134
  51. package/lib/pkce.ts +0 -79
  52. package/lib/reports.ts +0 -373
  53. package/lib/storage.ts +0 -367
  54. package/lib/supabase.ts +0 -826
  55. package/lib/util.ts +0 -134
  56. package/packages/postgres-ai/README.md +0 -26
  57. package/packages/postgres-ai/bin/postgres-ai.js +0 -27
  58. package/packages/postgres-ai/package.json +0 -27
  59. package/scripts/embed-checkup-dictionary.ts +0 -115
  60. package/scripts/embed-metrics.ts +0 -160
  61. package/scripts/generate-release-notes.ts +0 -668
  62. package/test/PERMISSION_CHECK_TEST_SUMMARY.md +0 -139
  63. package/test/aas-onboard.test.ts +0 -301
  64. package/test/auth.test.ts +0 -287
  65. package/test/checkup.integration.test.ts +0 -413
  66. package/test/checkup.test.ts +0 -3626
  67. package/test/compose-cmd.test.ts +0 -120
  68. package/test/config-consistency.test.ts +0 -352
  69. package/test/init.integration.test.ts +0 -438
  70. package/test/init.test.ts +0 -1816
  71. package/test/issues.cli.test.ts +0 -1162
  72. package/test/issues.test.ts +0 -456
  73. package/test/mcp-server.test.ts +0 -2530
  74. package/test/monitoring.test.ts +0 -746
  75. package/test/permission-check-sql.test.ts +0 -116
  76. package/test/reports.cli.test.ts +0 -793
  77. package/test/reports.test.ts +0 -977
  78. package/test/schema-validation.test.ts +0 -231
  79. package/test/storage.test.ts +0 -935
  80. package/test/supabase.test.ts +0 -709
  81. package/test/targets-add-config.test.ts +0 -28
  82. package/test/test-utils.ts +0 -190
  83. package/test/upgrade.test.ts +0 -1056
  84. package/test/util.test.ts +0 -44
  85. package/tsconfig.json +0 -20
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "K004 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "K004" },
14
+ "checkTitle": { "const": "Top queries by temp bytes written" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["queryid", "total_temp_bytes", "hourly_temp_bytes"],
56
+ "properties": {
57
+ "queryid": { "type": "string" },
58
+ "total_temp_bytes": { "type": "number" },
59
+ "hourly_temp_bytes": { "$ref": "#/$defs/hourlyNumbers" }
60
+ }
61
+ },
62
+ "summary": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "queries_returned",
67
+ "total_temp_bytes",
68
+ "total_temp_bytes_tracked_queries",
69
+ "total_temp_bytes_other",
70
+ "time_range_hours",
71
+ "hourly_timestamps",
72
+ "limit"
73
+ ],
74
+ "properties": {
75
+ "queries_returned": { "type": "integer" },
76
+ "total_temp_bytes": { "type": "number" },
77
+ "total_temp_bytes_tracked_queries": { "type": "number" },
78
+ "total_temp_bytes_other": { "type": "number" },
79
+ "time_range_hours": { "type": "integer" },
80
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
81
+ "limit": { "type": "integer" }
82
+ }
83
+ },
84
+ "dbEntry": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["top_queries", "other_temp_bytes_hourly", "summary"],
88
+ "properties": {
89
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
90
+ "other_temp_bytes_hourly": { "$ref": "#/$defs/hourlyNumbers" },
91
+ "summary": { "$ref": "#/$defs/summary" }
92
+ }
93
+ },
94
+ "data": {
95
+ "type": "object",
96
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
97
+ },
98
+ "nodeResult": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["data"],
102
+ "properties": {
103
+ "data": { "$ref": "#/$defs/data" },
104
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "K005 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "K005" },
14
+ "checkTitle": { "const": "Top queries by WAL generation" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["queryid", "total_wal_bytes", "hourly_wal_bytes"],
56
+ "properties": {
57
+ "queryid": { "type": "string" },
58
+ "total_wal_bytes": { "type": "number" },
59
+ "hourly_wal_bytes": { "$ref": "#/$defs/hourlyNumbers" }
60
+ }
61
+ },
62
+ "summary": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "queries_returned",
67
+ "total_wal_bytes",
68
+ "total_wal_bytes_tracked_queries",
69
+ "total_wal_bytes_other",
70
+ "time_range_hours",
71
+ "hourly_timestamps",
72
+ "limit"
73
+ ],
74
+ "properties": {
75
+ "queries_returned": { "type": "integer" },
76
+ "total_wal_bytes": { "type": "number" },
77
+ "total_wal_bytes_tracked_queries": { "type": "number" },
78
+ "total_wal_bytes_other": { "type": "number" },
79
+ "time_range_hours": { "type": "integer" },
80
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
81
+ "limit": { "type": "integer" }
82
+ }
83
+ },
84
+ "dbEntry": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["top_queries", "other_wal_bytes_hourly", "summary"],
88
+ "properties": {
89
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
90
+ "other_wal_bytes_hourly": { "$ref": "#/$defs/hourlyNumbers" },
91
+ "summary": { "$ref": "#/$defs/summary" }
92
+ }
93
+ },
94
+ "data": {
95
+ "type": "object",
96
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
97
+ },
98
+ "nodeResult": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["data"],
102
+ "properties": {
103
+ "data": { "$ref": "#/$defs/data" },
104
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "K006 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "K006" },
14
+ "checkTitle": { "const": "Top queries by shared blocks read" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["queryid", "total_shared_read_bytes", "hourly_shared_read_bytes"],
56
+ "properties": {
57
+ "queryid": { "type": "string" },
58
+ "total_shared_read_bytes": { "type": "number" },
59
+ "hourly_shared_read_bytes": { "$ref": "#/$defs/hourlyNumbers" }
60
+ }
61
+ },
62
+ "summary": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "queries_returned",
67
+ "total_shared_read_bytes",
68
+ "total_shared_read_bytes_tracked_queries",
69
+ "total_shared_read_bytes_other",
70
+ "time_range_hours",
71
+ "hourly_timestamps",
72
+ "limit"
73
+ ],
74
+ "properties": {
75
+ "queries_returned": { "type": "integer" },
76
+ "total_shared_read_bytes": { "type": "number" },
77
+ "total_shared_read_bytes_tracked_queries": { "type": "number" },
78
+ "total_shared_read_bytes_other": { "type": "number" },
79
+ "time_range_hours": { "type": "integer" },
80
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
81
+ "limit": { "type": "integer" }
82
+ }
83
+ },
84
+ "dbEntry": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["top_queries", "other_shared_read_bytes_hourly", "summary"],
88
+ "properties": {
89
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
90
+ "other_shared_read_bytes_hourly": { "$ref": "#/$defs/hourlyNumbers" },
91
+ "summary": { "$ref": "#/$defs/summary" }
92
+ }
93
+ },
94
+ "data": {
95
+ "type": "object",
96
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
97
+ },
98
+ "nodeResult": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["data"],
102
+ "properties": {
103
+ "data": { "$ref": "#/$defs/data" },
104
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "K007 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "K007" },
14
+ "checkTitle": { "const": "Top queries by shared blocks hit" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["queryid", "total_shared_hit_bytes", "hourly_shared_hit_bytes"],
56
+ "properties": {
57
+ "queryid": { "type": "string" },
58
+ "total_shared_hit_bytes": { "type": "number" },
59
+ "hourly_shared_hit_bytes": { "$ref": "#/$defs/hourlyNumbers" }
60
+ }
61
+ },
62
+ "summary": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "queries_returned",
67
+ "total_shared_hit_bytes",
68
+ "total_shared_hit_bytes_tracked_queries",
69
+ "total_shared_hit_bytes_other",
70
+ "time_range_hours",
71
+ "hourly_timestamps",
72
+ "limit"
73
+ ],
74
+ "properties": {
75
+ "queries_returned": { "type": "integer" },
76
+ "total_shared_hit_bytes": { "type": "number" },
77
+ "total_shared_hit_bytes_tracked_queries": { "type": "number" },
78
+ "total_shared_hit_bytes_other": { "type": "number" },
79
+ "time_range_hours": { "type": "integer" },
80
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
81
+ "limit": { "type": "integer" }
82
+ }
83
+ },
84
+ "dbEntry": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["top_queries", "other_shared_hit_bytes_hourly", "summary"],
88
+ "properties": {
89
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
90
+ "other_shared_hit_bytes_hourly": { "$ref": "#/$defs/hourlyNumbers" },
91
+ "summary": { "$ref": "#/$defs/summary" }
92
+ }
93
+ },
94
+ "data": {
95
+ "type": "object",
96
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
97
+ },
98
+ "nodeResult": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["data"],
102
+ "properties": {
103
+ "data": { "$ref": "#/$defs/data" },
104
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "K008 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": "string", "enum": ["full", "express"] },
13
+ "checkId": { "const": "K008" },
14
+ "checkTitle": { "const": "Top queries by shared blocks hit+read" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["queryid", "total_shared_hit_read_bytes", "hourly_shared_hit_read_bytes"],
56
+ "properties": {
57
+ "queryid": { "type": "string" },
58
+ "total_shared_hit_read_bytes": { "type": "number" },
59
+ "hourly_shared_hit_read_bytes": { "$ref": "#/$defs/hourlyNumbers" }
60
+ }
61
+ },
62
+ "summary": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "queries_returned",
67
+ "total_shared_hit_read_bytes",
68
+ "total_shared_hit_read_bytes_tracked_queries",
69
+ "total_shared_hit_read_bytes_other",
70
+ "time_range_hours",
71
+ "hourly_timestamps",
72
+ "limit"
73
+ ],
74
+ "properties": {
75
+ "queries_returned": { "type": "integer" },
76
+ "total_shared_hit_read_bytes": { "type": "number" },
77
+ "total_shared_hit_read_bytes_tracked_queries": { "type": "number" },
78
+ "total_shared_hit_read_bytes_other": { "type": "number" },
79
+ "time_range_hours": { "type": "integer" },
80
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
81
+ "limit": { "type": "integer" }
82
+ }
83
+ },
84
+ "dbEntry": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["top_queries", "other_shared_hit_read_bytes_hourly", "summary"],
88
+ "properties": {
89
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
90
+ "other_shared_hit_read_bytes_hourly": { "$ref": "#/$defs/hourlyNumbers" },
91
+ "summary": { "$ref": "#/$defs/summary" }
92
+ }
93
+ },
94
+ "data": {
95
+ "type": "object",
96
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
97
+ },
98
+ "nodeResult": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["data"],
102
+ "properties": {
103
+ "data": { "$ref": "#/$defs/data" },
104
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "M001 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "M001" },
14
+ "checkTitle": { "const": "Top queries by mean execution time" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "timeline": {
45
+ "type": "array",
46
+ "items": { "type": "integer" }
47
+ },
48
+ "hourlyNumbers": {
49
+ "type": "array",
50
+ "items": { "type": "number" }
51
+ },
52
+ "queryEntry": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": [
56
+ "queryid",
57
+ "mean_time_ms",
58
+ "total_time_ms",
59
+ "total_calls",
60
+ "hourly_time_ms",
61
+ "hourly_calls"
62
+ ],
63
+ "properties": {
64
+ "queryid": { "type": "string" },
65
+ "mean_time_ms": { "type": "number" },
66
+ "total_time_ms": { "type": "number" },
67
+ "total_calls": { "type": "number" },
68
+ "hourly_time_ms": { "$ref": "#/$defs/hourlyNumbers" },
69
+ "hourly_calls": { "$ref": "#/$defs/hourlyNumbers" }
70
+ }
71
+ },
72
+ "summary": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": [
76
+ "queries_returned",
77
+ "total_time_tracked_queries_ms",
78
+ "total_calls_tracked_queries",
79
+ "time_range_hours",
80
+ "hourly_timestamps",
81
+ "limit"
82
+ ],
83
+ "properties": {
84
+ "queries_returned": { "type": "integer" },
85
+ "total_time_tracked_queries_ms": { "type": "number" },
86
+ "total_calls_tracked_queries": { "type": "number" },
87
+ "time_range_hours": { "type": "integer" },
88
+ "hourly_timestamps": { "$ref": "#/$defs/timeline" },
89
+ "limit": { "type": "integer" }
90
+ }
91
+ },
92
+ "dbEntry": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": ["top_queries", "other_time_hourly", "other_calls_hourly", "summary"],
96
+ "properties": {
97
+ "top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryEntry" } },
98
+ "other_time_hourly": { "$ref": "#/$defs/hourlyNumbers" },
99
+ "other_calls_hourly": { "$ref": "#/$defs/hourlyNumbers" },
100
+ "summary": { "$ref": "#/$defs/summary" }
101
+ }
102
+ },
103
+ "data": {
104
+ "type": "object",
105
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
106
+ },
107
+ "nodeResult": {
108
+ "type": "object",
109
+ "additionalProperties": false,
110
+ "required": ["data"],
111
+ "properties": {
112
+ "data": { "$ref": "#/$defs/data" },
113
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+