feat(db): implement PostgreSQL monitoring and maintenance features
CI / changes (push) Successful in 9s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 26s
CI / web (push) Successful in 33s
CI / go (push) Successful in 2m11s
CI / bird2 (push) Successful in 16s
CI / release (push) Successful in 3m27s
CI / changes (push) Successful in 9s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 26s
CI / web (push) Successful in 33s
CI / go (push) Successful in 2m11s
CI / bird2 (push) Successful in 16s
CI / release (push) Successful in 3m27s
Added PostgreSQL monitoring and maintenance capabilities to the API, including new endpoints for instance-level metrics, maintenance operations, and job scheduling. Updated the HTTP API to support PostgreSQL monitoring routes and integrated a background scheduler for metrics collection. Enhanced the CLI with database commands for maintenance tasks. Updated documentation to reflect these changes.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DROP EXTENSION IF EXISTS pg_stat_statements;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- pg_stat_statements requires shared_preload_libraries on the server; extension may fail on dev without restart.
|
||||
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
|
||||
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS postgres_maintenance_audit;
|
||||
DROP TABLE IF EXISTS postgres_monitor_snapshot;
|
||||
@@ -0,0 +1,29 @@
|
||||
CREATE TABLE IF NOT EXISTS postgres_monitor_snapshot (
|
||||
id TEXT PRIMARY KEY,
|
||||
collected_at TIMESTAMPTZ NOT NULL,
|
||||
payload_json JSONB NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_postgres_monitor_snapshot_collected
|
||||
ON postgres_monitor_snapshot (collected_at DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS postgres_maintenance_audit (
|
||||
id TEXT PRIMARY KEY,
|
||||
tenant_id TEXT,
|
||||
actor_prefix TEXT,
|
||||
kind TEXT NOT NULL,
|
||||
target_table TEXT,
|
||||
dry_run BOOLEAN NOT NULL DEFAULT false,
|
||||
status TEXT NOT NULL,
|
||||
detail_json JSONB,
|
||||
error_message TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
started_at TIMESTAMPTZ,
|
||||
finished_at TIMESTAMPTZ,
|
||||
CONSTRAINT postgres_maintenance_audit_status_chk CHECK (
|
||||
status IN ('queued', 'running', 'succeeded', 'failed', 'cancelled')
|
||||
)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_postgres_maintenance_audit_created
|
||||
ON postgres_maintenance_audit (created_at DESC);
|
||||
Reference in New Issue
Block a user