Skip to content

Add new version of pgmanager#47

Merged
djthorpe merged 28 commits into
mainfrom
djt/0609/pgmanager
Jun 11, 2026
Merged

Add new version of pgmanager#47
djthorpe merged 28 commits into
mainfrom
djt/0609/pgmanager

Conversation

@djthorpe

@djthorpe djthorpe commented Jun 9, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 9, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new PostgreSQL management implementation (pgmanager/), expands the (currently ignored-by-Go) next-generation manager implementation under pkg/_manager/, updates the cmd/pgmanager entrypoint to use the go-server command framework, and adds HTTP error mapping to the core pg package.

Changes:

  • Add a new pgmanager/ module (manager, HTTP handlers, HTTP client, and CLI commands) including health, database, and connection operations plus OTEL metrics/spans.
  • Add new manager/schema/httpclient/httphandler code under pkg/_manager/ (in an underscore-prefixed folder).
  • Add pg.HTTPError mapping, and bump several dependencies in go.mod.

Reviewed changes

Copilot reviewed 25 out of 122 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pkg/test/main.go Removes (comments out) manager test helper code and associated import.
pkg/_manager/tablespace.go Adds tablespace CRUD logic (in underscore-prefixed directory).
pkg/_manager/statement.go Adds pg_stat_statements listing/reset API (underscore-prefixed directory).
pkg/_manager/statement_test.go Adds integration tests for statement stats (underscore-prefixed directory).
pkg/_manager/setting.go Adds server settings list/get/update/reload methods (underscore-prefixed directory).
pkg/_manager/schema/statement.go Adds statement schema types + SQL builder for pg_stat_statements (underscore-prefixed directory).
pkg/_manager/schema/setting.go Adds settings schema types + SQL for pg_settings and ALTER SYSTEM (underscore-prefixed directory).
pkg/_manager/schema/setting_test.go Adds unit tests for settings SQL selection and stringify (underscore-prefixed directory).
pkg/_manager/schema/globals.go Adds shared constants and extension bootstrap helpers (underscore-prefixed directory).
pkg/_manager/schema/doc.go Adds package documentation for manager schema (underscore-prefixed directory).
pkg/_manager/schema/connection.go Adds connection schema + SQL for pg_stat_activity (underscore-prefixed directory).
pkg/_manager/schema/connection_test.go Adds unit tests for connection schema selection logic (underscore-prefixed directory).
pkg/_manager/role.go Adds role CRUD/update logic (underscore-prefixed directory).
pkg/_manager/replicationslot.go Adds replication slot CRUD logic (underscore-prefixed directory).
pkg/_manager/README.md Adds documentation for the manager package architecture and usage (underscore-prefixed directory).
pkg/_manager/object.go Adds cross-database object listing/get logic (underscore-prefixed directory).
pkg/_manager/object_test.go Adds integration tests for object list/get (underscore-prefixed directory).
pkg/_manager/manager.go Adds manager constructor/bootstrap and internal iterators (underscore-prefixed directory).
pkg/_manager/httphandler/tablespace.go Adds REST handlers for tablespace endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/statement.go Adds REST handlers for statement stats endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/setting.go Adds REST handlers for server setting endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/schema.go Adds REST handlers for schema endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/role.go Adds REST handlers for role endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/replicationslot.go Adds REST handlers for replication slot endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/object.go Adds REST handlers for object listing/get endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/httphandler.go Adds handler registration and pg→HTTP error mapping (underscore-prefixed directory).
pkg/_manager/httphandler/frontend_included.go Adds embedded-frontend serving behind frontend build tag (underscore-prefixed directory).
pkg/_manager/httphandler/frontend_excluded.go Adds fallback frontend handler when frontend tag is off (underscore-prefixed directory).
pkg/_manager/httphandler/extension.go Adds REST handlers for extension endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/doc.go Adds package documentation for manager HTTP handlers (underscore-prefixed directory).
pkg/_manager/httphandler/database.go Adds REST handlers for database endpoints (underscore-prefixed directory).
pkg/_manager/httphandler/connection.go Adds REST handlers for connection endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/tablespace.go Adds typed HTTP client for tablespace endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/statement.go Adds typed HTTP client for statement endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/setting.go Adds typed HTTP client for setting endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/schema.go Adds typed HTTP client for schema endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/role.go Adds typed HTTP client for role endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/replicationslot.go Adds typed HTTP client for replication slot endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/opts.go Adds query option helpers for typed HTTP clients (underscore-prefixed directory).
pkg/_manager/httpclient/object.go Adds typed HTTP client for object endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/extension.go Adds typed HTTP client for extension endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/doc.go Adds package docs for manager HTTP client (underscore-prefixed directory).
pkg/_manager/httpclient/database.go Adds typed HTTP client for database endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/connection.go Adds typed HTTP client for connection endpoints (underscore-prefixed directory).
pkg/_manager/httpclient/client.go Adds constructor wrapper for the HTTP client (underscore-prefixed directory).
pkg/_manager/extension.go Adds extension list/get/create/update/delete logic (underscore-prefixed directory).
pkg/_manager/doc.go Adds package documentation for manager APIs (underscore-prefixed directory).
pkg/_manager/connection.go Adds connection list/get/delete logic (underscore-prefixed directory).
pkg/_manager/connection_test.go Adds integration tests for connection APIs (underscore-prefixed directory).
pgmanager/schema/globals.go Adds pgmanager schema globals/constants.
pgmanager/schema/connection.go Adds pgmanager connection types, SQL selection, and client query helpers.
pgmanager/schema/cluster.go Adds schema and SQL to retrieve cluster name.
pgmanager/manager/status.go Adds manager Ping with OTEL span.
pgmanager/manager/opt.go Adds options for tracer/meter/cluster naming.
pgmanager/manager/metrics.go Adds OTEL gauge registration for database size and connection counts.
pgmanager/manager/manager.go Adds pgmanager constructor, cluster lookup, and metric registration.
pgmanager/manager/connection.go Adds list/get/delete connection methods with spans and pagination clamp.
pgmanager/httphandlers/status.go Adds health handler registration and Ping endpoint.
pgmanager/httphandlers/database.go Adds OpenAPI-described database handlers.
pgmanager/httphandlers/connection.go Adds OpenAPI-described connection handlers.
pgmanager/httpclient/status.go Adds HTTP client Ping.
pgmanager/httpclient/database.go Adds HTTP client database CRUD.
pgmanager/httpclient/connection.go Adds HTTP client connection list/get/delete.
pgmanager/httpclient/client.go Adds pgmanager HTTP client constructor.
pgmanager/cmd/server.go Adds server command to run the pgmanager API server.
pgmanager/cmd/client.go Adds client commands for ping/databases/connections.
go.mod Updates Go/module dependencies (pgx, go-server, otel, x/sync, etc.).
error.go Adds HTTP error mapping and SQLSTATE handling updates to core pg errors.
cmd/pgmanager/main.go Switches pgmanager CLI to go-server/pkg/cmd entrypoint and wiring.
cmd/_pgmanager2/version.go Adds legacy/alternate CLI version command (underscore-prefixed directory).
cmd/_pgmanager2/tablespace.go Adds legacy/alternate CLI tablespace commands (underscore-prefixed directory).
cmd/_pgmanager2/statement.go Adds legacy/alternate CLI statement commands (underscore-prefixed directory).
cmd/_pgmanager2/setting.go Adds legacy/alternate CLI setting commands (underscore-prefixed directory).
cmd/_pgmanager2/server.go Adds legacy/alternate CLI server command (underscore-prefixed directory).
cmd/_pgmanager2/schema.go Adds legacy/alternate CLI schema commands (underscore-prefixed directory).
cmd/_pgmanager2/replicationslot.go Adds legacy/alternate CLI replication slot commands (underscore-prefixed directory).
cmd/_pgmanager2/object.go Adds legacy/alternate CLI object commands (underscore-prefixed directory).
cmd/_pgmanager2/main.go Adds legacy/alternate CLI entrypoint (underscore-prefixed directory).
cmd/_pgmanager2/extension.go Adds legacy/alternate CLI extension commands (underscore-prefixed directory).
cmd/_pgmanager2/database.go Adds legacy/alternate CLI database commands (underscore-prefixed directory).
cmd/_pgmanager2/connection.go Adds legacy/alternate CLI connection commands (underscore-prefixed directory).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/pgmanager/main.go Outdated
Comment thread cmd/pgmanager/main.go
Comment thread pgmanager/manager/manager.go
Comment thread pgmanager/manager/metrics.go Outdated
Comment thread pgmanager/manager/metrics.go
Comment thread pgmanager/manager/metrics.go
@github-actions

Copy link
Copy Markdown

Coverage for this change: 65.3%

@djthorpe djthorpe requested a review from Copilot June 11, 2026 10:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@djthorpe djthorpe merged commit d9800db into main Jun 11, 2026
3 checks passed
@djthorpe djthorpe deleted the djt/0609/pgmanager branch June 11, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants