feat(db): expose connection setup timeline - #7286
Open
ravarora2 wants to merge 1 commit into
Open
Conversation
🔐 Codex Security Review
|
ravarora2
force-pushed
the
rarora/db-connection-timeline
branch
from
September 3, 2026 19:27
f58e948 to
2c3e30d
Compare
Record operation checkout starts and bounded writer connection setup steps in metrics and lifecycle logs. Co-authored-by: Ravneet Arora <rarora@squareup.com> Signed-off-by: Ravneet Arora <rarora@squareup.com>
ravarora2
force-pushed
the
rarora/db-connection-timeline
branch
from
September 8, 2026 18:19
2c3e30d to
32d6e43
Compare
ravarora2
marked this pull request as ready for review
September 8, 2026 20:22
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.
Why
Current pool metrics show checkout outcomes and pool state after the fact. They do not show when a checkout began or which writer-connection setup step failed. During startup and pool growth, operators need to tell pool saturation from a slow or unsafe connection setup.
What
How
The existing typed checkout wrapper now records starts and current waiters. The huddle-history path uses that wrapper instead of a raw pool checkout.
The production SQLx
after_connecthook records each writer connection with a process boot ID, connection ordinal, and ordered setup steps. Fixed enums keep metric cardinality bounded. A drop guard records cancellation once if setup exits before a terminal result.Tests bind the production hook and cover initial minimum connections, later pool growth, cancellation, setup and isolation failures, Prometheus export, and relay boot output.
Risk
Medium. This changes the production writer-pool
after_connecthook and adds one counter update to instrumented checkout paths. It does not change the database safety statements or their failure behavior. The main residual risk is telemetry overhead when SQLx creates a replacement connection; the records have a fixed schema and bounded labels.Testing
Staging used pre-rebase head
f58e9480a4f068db0c591f604fd6800fdd4bfc45. The deployed multi-architecture image came from GitHub Actions run 33780888255, manifestsha256:b9351fa644e08376cbe1999f9bee311d33d1799a68eadef7929c4f862a832fec.The staging deployment brought both pods in ReplicaSet
buzz-6c8758bd7dto Ready with zero restarts. Every observed initial writer connection reacheddb_ready, and the new metrics produced data in the rollout dashboard.The rebase changed only the parent from
88687876f7808a2fd742b7eb2e4b9f87d999ad8dto currentmain;git range-diffshows the feature patch is unchanged.Bigger picture
This is the database-timeline part of the startup and rollout observability work. The early-startup lifecycle foundation merged in #7258, so the rebase removed that duplicate commit from this PR.
Originating discussion: buzz://message?channel=6ac85131-70cd-4bda-a031-38d34114934e&id=fa2bed181c092697210a60bb6eedc55a665d5c1c6cabc1413a04686647011f71
Generated with Codex