mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-11-12 00:48:08 +00:00
* feat(db): five pgx pools with fixed session settings and Prometheus tracing * feat(guards): per-family observe/enforce guards with client slots, deadlines and a shadow budget * fix(guards): attribute only guard deadlines and classify like the handlers * feat(db): route API statements by sqlc name; class C always unnamed * feat(admin): statement statistics by sqlc name; create pg_stat_statements where allowed * fix(db): skip pg_stat_statements when no schema is creatable * feat(background): index health against post-rebuild baselines, Postgres activity, job and ingest metrics * feat: separate API, ingest and maintenance stores; guards on the public API; metrics listener * fix(db): keep ingest writes waiting, size the ingest pool to the host, tidy * test(db): give the statements probe a query id of its own
20 lines
728 B
SQL
20 lines
728 B
SQL
-- Copyright 2026 Beacon Contributors
|
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
-- Statement statistics for GET /api/v1/admin/db/statements. Skipped with a notice where the
|
|
-- extension is not installed, this role may not create it, or no schema on the search_path is
|
|
-- creatable; the endpoint then answers 503.
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (SELECT 1 FROM pg_available_extensions WHERE name = 'pg_stat_statements') THEN
|
|
BEGIN
|
|
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
|
|
EXCEPTION WHEN insufficient_privilege OR invalid_schema_name THEN
|
|
RAISE NOTICE 'pg_stat_statements not created: %', SQLERRM;
|
|
END;
|
|
ELSE
|
|
RAISE NOTICE 'pg_stat_statements is not available on this server';
|
|
END IF;
|
|
END
|
|
$$;
|