
How to find which deploy made your Postgres queries slower?
pg-regression-radar detects PostgreSQL query-latency regressions and attributes each one to the deploy that caused it.
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Documentation · Installation · Getting started · Roadmap
pg-regression-radar detects PostgreSQL query-latency regressions and attributes each one to the deploy that caused it.
It samples pg_stat_statements, ingests deploy events from your GitOps tooling (Argo CD, Argo Rollouts, Flux, or a generic webhook), and runs a two-stage statistical test on every query: E-divisive change-point location, confirmed by Welch's t-test. When a shift is significant, it reports the query, the deploy, the size of the change and a confidence score, and sends the result to Slack, Microsoft Teams, PagerDuty or a custom webhook.
It targets teams that run Postgres on Kubernetes (CloudNativePG, Zalando, Crunchy, Percona and others) and ship application changes several times a day, where "which deploy caused this?" is otherwise answered by hand from dashboards.
Statistical detection. Change-point location plus a significance test, not a before/after average. See Detection Algorithm.
Deploy correlation, or none. Regressions are tied to deploy events from Argo CD, Argo Rollouts, Flux, generic webhooks and Kubernetes, or detected on a rolling schedule with no deploy at all. See Periodic Detection.
Plan-diff correlation. Captures EXPLAIN (FORMAT JSON, GENERIC_PLAN) around a regression to separate a changed plan from the same plan running slower.
One binary, four commands. pg-regression-radar operator runs everything in one process for a single cluster; manager is the leader-elected, CRD-driven controller for a fleet; collector and ingester run the metric scraper and the deploy-webhook receiver on their own. See Architecture.
Multi-cluster. One manager can watch PostgresWatch resources whose databases live in other Kubernetes clusters. See Multi-Cluster Mode.
Flexible sample source. Scrapes pg_stat_statements directly, or reads from an existing OpenTelemetry/Prometheus pipeline. See OTel/Prometheus Source.
Audit trail. In manager mode every regression is stored as a PerformanceRegression resource (kubectl get performanceregressions -A).
Optional auto-abort. Can abort an Argo Rollouts canary when a regression crosses your confidence threshold. Disabled by default and scoped per PostgresWatch. See Auto-Abort.
How it works
flowchart LR PG[("PostgreSQL<br/>pg_stat_statements")] -- scrape --> COL["Collector"] DS["Deploy sources<br/>ArgoCD · Argo Rollouts · Flux"] -- "webhook / watch" --> ING["Deploy Event Ingester"] SCHED(["Rolling schedule<br/>no deploy needed"]) -. "on a schedule" .-> CE COL -- samples --> CE["Correlation Engine<br/>E-divisive change-point + Welch's t-test"] ING -- "deploy events" --> CE CE -- alert --> ALERT["Alerting<br/>Slack · Teams · PagerDuty · custom"] CE -- "manager mode" --> CR[("PerformanceRegression<br/>status (kubectl-visible)")]
Loading
The Collector scrapes pg_stat_statements on an interval and keeps a bounded time series per queryid.
The Deploy Event Ingester receives webhooks from Argo CD, Argo Rollouts and Flux and stores normalised DeployEvent records.
The Correlation Engine runs detection for each deploy event, or on a rolling schedule.
Alerting sends the query text, latency before and after, change factor and confidence.
Example
Full walkthrough: Regression Scenario Example.
Illustrative rendering of the numbers the scripted example produces. The project emits alerts and custom resources; it does not ship a dashboard.
Install the CLI and run it against a single cluster:
go install github.com/joao00001/pg-regression-radar/cmd/pg-regression-radar@latest
pg-regression-radar operator
--dsn "postgres://user:password@localhost:5432/mydb?sslmode=disable"
--cluster-name my-cluster
--slack-url https://hooks.slack.com/services/XXX/YYY/ZZZ
--source-type argocd
--dsn takes a full PostgreSQL connection URI (postgres://user:password@host:port/dbname?sslmode=disable).
From a clone, use go run ./cmd/operator with the same flags.
For Docker and Helm installs, the HA CRD-driven manager and every flag, see Installation, Getting Started, Quickstart Validation and the Configuration Reference.
PostgreSQL 16, 17 and 18, including community builds, CloudNativePG and EDB Postgres Advanced/Extended Server, tested in CI. See the Support Matrix.
Signed releases. Container images and the Helm chart are Cosign keyless-signed, with SLSA provenance and an SBOM. See Supply Chain Verification.
Documented threat model with three security profiles (controlled, hardened, relay-only) that govern which Secrets may be read and where the manager may connect. See the Security Model.
Documentation
Full documentation is at joao00001.github.io/pg-regression-radar.
The site is built from docs/ with MkDocs Material. Read docs/TEMPLATE.md before adding a page. To preview locally:
pip install -r requirements-docs.txt mkdocs serve # http://127.0.0.1:8000
Contributing
Contributions are welcome. CONTRIBUTING.md covers commit and PR conventions (Conventional Commits, DCO sign-off, squash merges) and branch naming; please also read the Code of Conduct. Before opening a pull request:
go build ./... go vet ./... go test ./...
License
Released under the Apache License 2.0.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。