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.
- package/README.md +154 -0
- package/dist/bin/postgres-ai.js +2911 -255
- package/package.json +12 -3
- package/schemas/A002.schema.json +63 -0
- package/schemas/A003.schema.json +73 -0
- package/schemas/A004.schema.json +81 -0
- package/schemas/A007.schema.json +71 -0
- package/schemas/A013.schema.json +61 -0
- package/schemas/D001.schema.json +71 -0
- package/schemas/D004.schema.json +136 -0
- package/schemas/F001.schema.json +73 -0
- package/schemas/F002.schema.json +108 -0
- package/schemas/F003.schema.json +138 -0
- package/schemas/F004.schema.json +125 -0
- package/schemas/F005.schema.json +131 -0
- package/schemas/F009.schema.json +155 -0
- package/schemas/G001.schema.json +135 -0
- package/schemas/G003.schema.json +90 -0
- package/schemas/H001.schema.json +141 -0
- package/schemas/H002.schema.json +129 -0
- package/schemas/H004.schema.json +128 -0
- package/schemas/I001.schema.json +149 -0
- package/schemas/K001.schema.json +161 -0
- package/schemas/K003.schema.json +163 -0
- package/schemas/K004.schema.json +110 -0
- package/schemas/K005.schema.json +110 -0
- package/schemas/K006.schema.json +110 -0
- package/schemas/K007.schema.json +110 -0
- package/schemas/K008.schema.json +110 -0
- package/schemas/M001.schema.json +119 -0
- package/schemas/M002.schema.json +110 -0
- package/schemas/M003.schema.json +128 -0
- package/schemas/N001.schema.json +161 -0
- package/schemas/query.schema.json +62 -0
- package/CHANGELOG.md +0 -11
- package/bin/postgres-ai.ts +0 -5578
- package/bun.lock +0 -258
- package/bunfig.toml +0 -20
- package/lib/aas-onboard.ts +0 -251
- package/lib/auth-server.ts +0 -285
- package/lib/checkup-api.ts +0 -526
- package/lib/checkup-dictionary.ts +0 -103
- package/lib/checkup-summary.ts +0 -338
- package/lib/checkup.ts +0 -2261
- package/lib/config.ts +0 -171
- package/lib/init.ts +0 -1152
- package/lib/instances.ts +0 -245
- package/lib/issues.ts +0 -1060
- package/lib/mcp-server.ts +0 -667
- package/lib/metrics-loader.ts +0 -134
- package/lib/pkce.ts +0 -79
- package/lib/reports.ts +0 -373
- package/lib/storage.ts +0 -367
- package/lib/supabase.ts +0 -826
- package/lib/util.ts +0 -134
- package/packages/postgres-ai/README.md +0 -26
- package/packages/postgres-ai/bin/postgres-ai.js +0 -27
- package/packages/postgres-ai/package.json +0 -27
- package/scripts/embed-checkup-dictionary.ts +0 -115
- package/scripts/embed-metrics.ts +0 -160
- package/scripts/generate-release-notes.ts +0 -668
- package/test/PERMISSION_CHECK_TEST_SUMMARY.md +0 -139
- package/test/aas-onboard.test.ts +0 -301
- package/test/auth.test.ts +0 -287
- package/test/checkup.integration.test.ts +0 -413
- package/test/checkup.test.ts +0 -3626
- package/test/compose-cmd.test.ts +0 -120
- package/test/config-consistency.test.ts +0 -352
- package/test/init.integration.test.ts +0 -438
- package/test/init.test.ts +0 -1816
- package/test/issues.cli.test.ts +0 -1162
- package/test/issues.test.ts +0 -456
- package/test/mcp-server.test.ts +0 -2530
- package/test/monitoring.test.ts +0 -746
- package/test/permission-check-sql.test.ts +0 -116
- package/test/reports.cli.test.ts +0 -793
- package/test/reports.test.ts +0 -977
- package/test/schema-validation.test.ts +0 -231
- package/test/storage.test.ts +0 -935
- package/test/supabase.test.ts +0 -709
- package/test/targets-add-config.test.ts +0 -28
- package/test/test-utils.ts +0 -190
- package/test/upgrade.test.ts +0 -1056
- package/test/util.test.ts +0 -44
- package/tsconfig.json +0 -20
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "H004 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": "H004" },
|
|
14
|
+
"checkTitle": { "const": "Redundant indexes" },
|
|
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
|
+
"redundantToIndex": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": ["index_name", "index_definition", "index_size_bytes", "index_size_pretty"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"index_name": { "type": "string" },
|
|
50
|
+
"index_definition": { "type": "string" },
|
|
51
|
+
"index_size_bytes": { "type": "number" },
|
|
52
|
+
"index_size_pretty": { "type": "string" }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"redundantIndex": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"required": [
|
|
59
|
+
"schema_name",
|
|
60
|
+
"table_name",
|
|
61
|
+
"index_name",
|
|
62
|
+
"relation_name",
|
|
63
|
+
"access_method",
|
|
64
|
+
"reason",
|
|
65
|
+
"index_size_bytes",
|
|
66
|
+
"table_size_bytes",
|
|
67
|
+
"index_usage",
|
|
68
|
+
"supports_fk",
|
|
69
|
+
"index_definition",
|
|
70
|
+
"index_size_pretty",
|
|
71
|
+
"table_size_pretty",
|
|
72
|
+
"redundant_to"
|
|
73
|
+
],
|
|
74
|
+
"properties": {
|
|
75
|
+
"schema_name": { "type": "string" },
|
|
76
|
+
"table_name": { "type": "string" },
|
|
77
|
+
"index_name": { "type": "string" },
|
|
78
|
+
"relation_name": { "type": "string" },
|
|
79
|
+
"access_method": { "type": "string" },
|
|
80
|
+
"reason": { "type": "string" },
|
|
81
|
+
"index_size_bytes": { "type": "number" },
|
|
82
|
+
"table_size_bytes": { "type": "number" },
|
|
83
|
+
"index_usage": { "type": "number" },
|
|
84
|
+
"supports_fk": { "type": "boolean" },
|
|
85
|
+
"index_definition": { "type": "string" },
|
|
86
|
+
"index_size_pretty": { "type": "string" },
|
|
87
|
+
"table_size_pretty": { "type": "string" },
|
|
88
|
+
"redundant_to": { "type": "array", "items": { "$ref": "#/$defs/redundantToIndex" } },
|
|
89
|
+
"redundant_to_parse_error": { "type": "string" }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"dbEntry": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"additionalProperties": false,
|
|
95
|
+
"required": [
|
|
96
|
+
"redundant_indexes",
|
|
97
|
+
"total_count",
|
|
98
|
+
"total_size_bytes",
|
|
99
|
+
"total_size_pretty",
|
|
100
|
+
"database_size_bytes",
|
|
101
|
+
"database_size_pretty"
|
|
102
|
+
],
|
|
103
|
+
"properties": {
|
|
104
|
+
"redundant_indexes": { "type": "array", "items": { "$ref": "#/$defs/redundantIndex" } },
|
|
105
|
+
"total_count": { "type": "integer" },
|
|
106
|
+
"total_size_bytes": { "type": "number" },
|
|
107
|
+
"total_size_pretty": { "type": "string" },
|
|
108
|
+
"database_size_bytes": { "type": "number" },
|
|
109
|
+
"database_size_pretty": { "type": "string" }
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"data": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"additionalProperties": { "$ref": "#/$defs/dbEntry" }
|
|
115
|
+
},
|
|
116
|
+
"nodeResult": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"required": ["data"],
|
|
120
|
+
"properties": {
|
|
121
|
+
"data": { "$ref": "#/$defs/data" },
|
|
122
|
+
"postgres_version": { "$ref": "#/$defs/postgresVersion" }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "I001 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": "I001" },
|
|
14
|
+
"checkTitle": { "const": "I/O statistics (pg_stat_io)" },
|
|
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
|
+
"backendIOStats": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": [
|
|
48
|
+
"backend_type",
|
|
49
|
+
"reads",
|
|
50
|
+
"read_bytes_mb",
|
|
51
|
+
"read_time_ms",
|
|
52
|
+
"writes",
|
|
53
|
+
"write_bytes_mb",
|
|
54
|
+
"write_time_ms",
|
|
55
|
+
"writebacks",
|
|
56
|
+
"writeback_bytes_mb",
|
|
57
|
+
"writeback_time_ms",
|
|
58
|
+
"fsyncs",
|
|
59
|
+
"fsync_time_ms",
|
|
60
|
+
"hits",
|
|
61
|
+
"evictions",
|
|
62
|
+
"reuses"
|
|
63
|
+
],
|
|
64
|
+
"properties": {
|
|
65
|
+
"backend_type": { "type": "string" },
|
|
66
|
+
"reads": { "type": "number" },
|
|
67
|
+
"read_bytes_mb": { "type": "number" },
|
|
68
|
+
"read_time_ms": { "type": "number" },
|
|
69
|
+
"writes": { "type": "number" },
|
|
70
|
+
"write_bytes_mb": { "type": "number" },
|
|
71
|
+
"write_time_ms": { "type": "number" },
|
|
72
|
+
"writebacks": { "type": "number" },
|
|
73
|
+
"writeback_bytes_mb": { "type": "number" },
|
|
74
|
+
"writeback_time_ms": { "type": "number" },
|
|
75
|
+
"fsyncs": { "type": "number" },
|
|
76
|
+
"fsync_time_ms": { "type": "number" },
|
|
77
|
+
"extends": {
|
|
78
|
+
"type": "number",
|
|
79
|
+
"description": "Number of relation extension operations reported by pg_stat_io. Populated for PostgreSQL 16+ backends."
|
|
80
|
+
},
|
|
81
|
+
"extend_bytes_mb": {
|
|
82
|
+
"type": "number",
|
|
83
|
+
"description": "Mebibytes extended by pg_stat_io. PostgreSQL 16 derives this from extends * op_bytes; PostgreSQL 18+ uses the native extend_bytes column."
|
|
84
|
+
},
|
|
85
|
+
"hits": { "type": "number" },
|
|
86
|
+
"evictions": { "type": "number" },
|
|
87
|
+
"reuses": { "type": "number" }
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"analysis": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": ["total_read_mb", "total_write_mb", "total_io_time_ms", "read_hit_ratio_pct"],
|
|
94
|
+
"properties": {
|
|
95
|
+
"total_read_mb": {
|
|
96
|
+
"type": "number",
|
|
97
|
+
"description": "Total read volume in MiB. Historical field name retains the _mb suffix for compatibility."
|
|
98
|
+
},
|
|
99
|
+
"total_write_mb": {
|
|
100
|
+
"type": "number",
|
|
101
|
+
"description": "Total write volume in MiB. Historical field name retains the _mb suffix for compatibility."
|
|
102
|
+
},
|
|
103
|
+
"total_io_time_ms": {
|
|
104
|
+
"type": "number",
|
|
105
|
+
"description": "Total read_time_ms + write_time_ms across backends. Excludes writeback and fsync time."
|
|
106
|
+
},
|
|
107
|
+
"read_hit_ratio_pct": {
|
|
108
|
+
"type": "number",
|
|
109
|
+
"description": "Buffer hit ratio percentage: 100 * hits / (hits + reads)."
|
|
110
|
+
},
|
|
111
|
+
"avg_read_time_ms": {
|
|
112
|
+
"type": ["number", "null"],
|
|
113
|
+
"description": "Average read latency in milliseconds per read operation; null when total reads is zero."
|
|
114
|
+
},
|
|
115
|
+
"avg_write_time_ms": {
|
|
116
|
+
"type": ["number", "null"],
|
|
117
|
+
"description": "Average write latency in milliseconds per write operation; null when total writes is zero."
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"data": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"required": ["available", "by_backend_type", "analysis", "stats_reset_s"],
|
|
125
|
+
"properties": {
|
|
126
|
+
"available": { "type": "boolean" },
|
|
127
|
+
"min_version_required": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"description": "Minimum PostgreSQL major version required for this check. Present when available is false because pg_stat_io is unsupported."
|
|
130
|
+
},
|
|
131
|
+
"by_backend_type": {
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": { "$ref": "#/$defs/backendIOStats" }
|
|
134
|
+
},
|
|
135
|
+
"analysis": { "$ref": "#/$defs/analysis" },
|
|
136
|
+
"stats_reset_s": { "type": ["number", "null"] }
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"nodeResult": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"additionalProperties": false,
|
|
142
|
+
"required": ["data"],
|
|
143
|
+
"properties": {
|
|
144
|
+
"data": { "$ref": "#/$defs/data" },
|
|
145
|
+
"postgres_version": { "$ref": "#/$defs/postgresVersion" }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "K001 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": "K001" },
|
|
14
|
+
"checkTitle": { "const": "Globally aggregated query metrics" },
|
|
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
|
+
"queryMetric": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": [
|
|
48
|
+
"queryid",
|
|
49
|
+
"database",
|
|
50
|
+
"user",
|
|
51
|
+
"duration_seconds",
|
|
52
|
+
"calls",
|
|
53
|
+
"calls_per_sec",
|
|
54
|
+
"calls_per_call",
|
|
55
|
+
"total_time",
|
|
56
|
+
"total_time_per_sec",
|
|
57
|
+
"total_time_per_call",
|
|
58
|
+
"rows",
|
|
59
|
+
"rows_per_sec",
|
|
60
|
+
"rows_per_call",
|
|
61
|
+
"shared_blks_hit",
|
|
62
|
+
"shared_blks_hit_per_sec",
|
|
63
|
+
"shared_blks_hit_per_call",
|
|
64
|
+
"shared_blks_read",
|
|
65
|
+
"shared_blks_read_per_sec",
|
|
66
|
+
"shared_blks_read_per_call",
|
|
67
|
+
"shared_blks_dirtied",
|
|
68
|
+
"shared_blks_dirtied_per_sec",
|
|
69
|
+
"shared_blks_dirtied_per_call",
|
|
70
|
+
"shared_blks_written",
|
|
71
|
+
"shared_blks_written_per_sec",
|
|
72
|
+
"shared_blks_written_per_call",
|
|
73
|
+
"blk_read_time",
|
|
74
|
+
"blk_read_time_per_sec",
|
|
75
|
+
"blk_read_time_per_call",
|
|
76
|
+
"blk_write_time",
|
|
77
|
+
"blk_write_time_per_sec",
|
|
78
|
+
"blk_write_time_per_call"
|
|
79
|
+
],
|
|
80
|
+
"properties": {
|
|
81
|
+
"queryid": { "type": "string" },
|
|
82
|
+
"database": { "type": "string" },
|
|
83
|
+
"user": { "type": "string" },
|
|
84
|
+
"duration_seconds": { "type": "number" },
|
|
85
|
+
"calls": { "type": "number" },
|
|
86
|
+
"calls_per_sec": { "type": "number" },
|
|
87
|
+
"calls_per_call": { "type": "number" },
|
|
88
|
+
"total_time": { "type": "number" },
|
|
89
|
+
"total_time_per_sec": { "type": "number" },
|
|
90
|
+
"total_time_per_call": { "type": "number" },
|
|
91
|
+
"rows": { "type": "number" },
|
|
92
|
+
"rows_per_sec": { "type": "number" },
|
|
93
|
+
"rows_per_call": { "type": "number" },
|
|
94
|
+
"shared_blks_hit": { "type": "number" },
|
|
95
|
+
"shared_blks_hit_per_sec": { "type": "number" },
|
|
96
|
+
"shared_blks_hit_per_call": { "type": "number" },
|
|
97
|
+
"shared_blks_read": { "type": "number" },
|
|
98
|
+
"shared_blks_read_per_sec": { "type": "number" },
|
|
99
|
+
"shared_blks_read_per_call": { "type": "number" },
|
|
100
|
+
"shared_blks_dirtied": { "type": "number" },
|
|
101
|
+
"shared_blks_dirtied_per_sec": { "type": "number" },
|
|
102
|
+
"shared_blks_dirtied_per_call": { "type": "number" },
|
|
103
|
+
"shared_blks_written": { "type": "number" },
|
|
104
|
+
"shared_blks_written_per_sec": { "type": "number" },
|
|
105
|
+
"shared_blks_written_per_call": { "type": "number" },
|
|
106
|
+
"blk_read_time": { "type": "number" },
|
|
107
|
+
"blk_read_time_per_sec": { "type": "number" },
|
|
108
|
+
"blk_read_time_per_call": { "type": "number" },
|
|
109
|
+
"blk_write_time": { "type": "number" },
|
|
110
|
+
"blk_write_time_per_sec": { "type": "number" },
|
|
111
|
+
"blk_write_time_per_call": { "type": "number" }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"summary": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"additionalProperties": false,
|
|
117
|
+
"required": [
|
|
118
|
+
"total_queries",
|
|
119
|
+
"total_calls",
|
|
120
|
+
"total_time_ms",
|
|
121
|
+
"total_rows",
|
|
122
|
+
"time_range_minutes",
|
|
123
|
+
"start_time",
|
|
124
|
+
"end_time"
|
|
125
|
+
],
|
|
126
|
+
"properties": {
|
|
127
|
+
"total_queries": { "type": "integer" },
|
|
128
|
+
"total_calls": { "type": "number" },
|
|
129
|
+
"total_time_ms": { "type": "number" },
|
|
130
|
+
"total_rows": { "type": "number" },
|
|
131
|
+
"time_range_minutes": { "type": "integer" },
|
|
132
|
+
"start_time": { "type": "string" },
|
|
133
|
+
"end_time": { "type": "string" }
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"dbEntry": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"required": ["query_metrics", "summary"],
|
|
140
|
+
"properties": {
|
|
141
|
+
"query_metrics": { "type": "array", "items": { "$ref": "#/$defs/queryMetric" } },
|
|
142
|
+
"summary": { "$ref": "#/$defs/summary" }
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"data": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"additionalProperties": { "$ref": "#/$defs/dbEntry" }
|
|
148
|
+
},
|
|
149
|
+
"nodeResult": {
|
|
150
|
+
"type": "object",
|
|
151
|
+
"additionalProperties": false,
|
|
152
|
+
"required": ["data"],
|
|
153
|
+
"properties": {
|
|
154
|
+
"data": { "$ref": "#/$defs/data" },
|
|
155
|
+
"postgres_version": { "$ref": "#/$defs/postgresVersion" }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "K003 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": "K003" },
|
|
14
|
+
"checkTitle": { "const": "Top queries by total time (total_exec_time + total_plan_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
|
+
"queryMetric": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": [
|
|
48
|
+
"queryid",
|
|
49
|
+
"database",
|
|
50
|
+
"user",
|
|
51
|
+
"duration_seconds",
|
|
52
|
+
"calls",
|
|
53
|
+
"calls_per_sec",
|
|
54
|
+
"calls_per_call",
|
|
55
|
+
"total_time",
|
|
56
|
+
"total_time_per_sec",
|
|
57
|
+
"total_time_per_call",
|
|
58
|
+
"rows",
|
|
59
|
+
"rows_per_sec",
|
|
60
|
+
"rows_per_call",
|
|
61
|
+
"shared_blks_hit",
|
|
62
|
+
"shared_blks_hit_per_sec",
|
|
63
|
+
"shared_blks_hit_per_call",
|
|
64
|
+
"shared_blks_read",
|
|
65
|
+
"shared_blks_read_per_sec",
|
|
66
|
+
"shared_blks_read_per_call",
|
|
67
|
+
"shared_blks_dirtied",
|
|
68
|
+
"shared_blks_dirtied_per_sec",
|
|
69
|
+
"shared_blks_dirtied_per_call",
|
|
70
|
+
"shared_blks_written",
|
|
71
|
+
"shared_blks_written_per_sec",
|
|
72
|
+
"shared_blks_written_per_call",
|
|
73
|
+
"blk_read_time",
|
|
74
|
+
"blk_read_time_per_sec",
|
|
75
|
+
"blk_read_time_per_call",
|
|
76
|
+
"blk_write_time",
|
|
77
|
+
"blk_write_time_per_sec",
|
|
78
|
+
"blk_write_time_per_call"
|
|
79
|
+
],
|
|
80
|
+
"properties": {
|
|
81
|
+
"queryid": { "type": "string" },
|
|
82
|
+
"database": { "type": "string" },
|
|
83
|
+
"user": { "type": "string" },
|
|
84
|
+
"duration_seconds": { "type": "number" },
|
|
85
|
+
"calls": { "type": "number" },
|
|
86
|
+
"calls_per_sec": { "type": "number" },
|
|
87
|
+
"calls_per_call": { "type": "number" },
|
|
88
|
+
"total_time": { "type": "number" },
|
|
89
|
+
"total_time_per_sec": { "type": "number" },
|
|
90
|
+
"total_time_per_call": { "type": "number" },
|
|
91
|
+
"rows": { "type": "number" },
|
|
92
|
+
"rows_per_sec": { "type": "number" },
|
|
93
|
+
"rows_per_call": { "type": "number" },
|
|
94
|
+
"shared_blks_hit": { "type": "number" },
|
|
95
|
+
"shared_blks_hit_per_sec": { "type": "number" },
|
|
96
|
+
"shared_blks_hit_per_call": { "type": "number" },
|
|
97
|
+
"shared_blks_read": { "type": "number" },
|
|
98
|
+
"shared_blks_read_per_sec": { "type": "number" },
|
|
99
|
+
"shared_blks_read_per_call": { "type": "number" },
|
|
100
|
+
"shared_blks_dirtied": { "type": "number" },
|
|
101
|
+
"shared_blks_dirtied_per_sec": { "type": "number" },
|
|
102
|
+
"shared_blks_dirtied_per_call": { "type": "number" },
|
|
103
|
+
"shared_blks_written": { "type": "number" },
|
|
104
|
+
"shared_blks_written_per_sec": { "type": "number" },
|
|
105
|
+
"shared_blks_written_per_call": { "type": "number" },
|
|
106
|
+
"blk_read_time": { "type": "number" },
|
|
107
|
+
"blk_read_time_per_sec": { "type": "number" },
|
|
108
|
+
"blk_read_time_per_call": { "type": "number" },
|
|
109
|
+
"blk_write_time": { "type": "number" },
|
|
110
|
+
"blk_write_time_per_sec": { "type": "number" },
|
|
111
|
+
"blk_write_time_per_call": { "type": "number" }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"summary": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"additionalProperties": false,
|
|
117
|
+
"required": [
|
|
118
|
+
"queries_returned",
|
|
119
|
+
"total_calls",
|
|
120
|
+
"total_time_ms",
|
|
121
|
+
"total_rows",
|
|
122
|
+
"time_range_minutes",
|
|
123
|
+
"start_time",
|
|
124
|
+
"end_time",
|
|
125
|
+
"limit"
|
|
126
|
+
],
|
|
127
|
+
"properties": {
|
|
128
|
+
"queries_returned": { "type": "integer" },
|
|
129
|
+
"total_calls": { "type": "number" },
|
|
130
|
+
"total_time_ms": { "type": "number" },
|
|
131
|
+
"total_rows": { "type": "number" },
|
|
132
|
+
"time_range_minutes": { "type": "integer" },
|
|
133
|
+
"start_time": { "type": "string" },
|
|
134
|
+
"end_time": { "type": "string" },
|
|
135
|
+
"limit": { "type": "integer" }
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"dbEntry": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"additionalProperties": false,
|
|
141
|
+
"required": ["top_queries", "summary"],
|
|
142
|
+
"properties": {
|
|
143
|
+
"top_queries": { "type": "array", "items": { "$ref": "#/$defs/queryMetric" } },
|
|
144
|
+
"summary": { "$ref": "#/$defs/summary" }
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"data": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"additionalProperties": { "$ref": "#/$defs/dbEntry" }
|
|
150
|
+
},
|
|
151
|
+
"nodeResult": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"additionalProperties": false,
|
|
154
|
+
"required": ["data"],
|
|
155
|
+
"properties": {
|
|
156
|
+
"data": { "$ref": "#/$defs/data" },
|
|
157
|
+
"postgres_version": { "$ref": "#/$defs/postgresVersion" }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|