T-17092: Fix PgBouncer rejecting cluster-agent statement_timeout startup parameter#126
Merged
paweljw merged 1 commit intoMar 30, 2026
Conversation
…ut from DSN coroot-cluster-agent hardcodes statement_timeout=<ms> as a PostgreSQL DSN parameter. lib/pq sends DSN parameters as startup parameters during the connection handshake. PgBouncer (since v1.20.0) rejects unrecognized startup parameters, breaking metrics collection for customers using PgBouncer as a connection pooler. The fix removes statement_timeout from the DSN. Query timeouts are still enforced client-side via Go's context.WithTimeout in the collector's Collect() method. To apply this patch, we now build cluster-agent from source (like we already do for node-agent) instead of pulling a pre-built image. Also upgrades cluster-agent from v1.2.4 to v1.6.1. Adds a CI workflow (cluster-agent-patch-ci.yml) to verify patches apply cleanly and pass upstream tests, mirroring the node-agent-patch-ci pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
91e47be to
cc18c2e
Compare
Member
Author
|
I’m 50/50 on whether we need to fix this on our side. Workaround exists (linked pgbouncer issue), and it seems this also has been resolved in pgbouncer 1.20.1+, so mid-2023. Thoughts @curusarn ? The fix is involved, ie another “soft fork”. |
curusarn
approved these changes
Mar 28, 2026
Contributor
curusarn
left a comment
There was a problem hiding this comment.
Thank you! I'm okay with the patch + build from source. I care more about less issues for customers. 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
statement_timeoutfrom PostgreSQL DSN parameters —lib/pqsends these as startup parameters during the connection handshake, and PgBouncer (since v1.20.0) rejects unrecognized onescontext.WithTimeoutContext
Customers using PgBouncer as a connection pooler see metrics collection fail because
coroot-cluster-agenthardcodesstatement_timeout=<ms>in the PostgreSQL DSN. PgBouncer rejects it as an unrecognized startup parameter (pgbouncer/pgbouncer#907).The issue is not fixed upstream —
statement_timeoutis still present in the latest cluster-agent release (v1.6.1).Changes
ebpf/Dockerfile: Replace pre-builtghcr.io/coroot/coroot-cluster-agent:1.2.4image with a from-source build stage (mirrors the existing node-agent pattern)ebpf/patches/cluster-agent/001-remove-statement-timeout-from-dsn.patch: Removesstatement_timeoutfrom DSN query params and the now-unusedstrconvimport