Repository navigation
Instrument connection pool checkout waits - #59308
Merged
Merged
Conversation
andrewfader
force-pushed
the
ar-connection-pool-checkout-wait
branch
3 times, most recently
from
October 29, 2026 17:54
e1eb4ab to
29b7dc9
Compare
Member
|
This makes sense to me, but that event need to be added to |
Active Record emits no event when a checkout blocks on a full pool, so the only signal of pool saturation is the ConnectionTimeoutError at the end of the wait. Instrument the wait as checkout_wait.active_record, with the pool and checkout_timeout in the payload. The event fires only on the blocking path, so a checkout served by an idle or new connection pays nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
andrewfader
force-pushed
the
ar-connection-pool-checkout-wait
branch
from
October 31, 2026 19:13
29b7dc9 to
0cbab48
Compare
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.
Motivation / Background
When every connection in a pool is leased,
checkoutblocks for up tocheckout_timeout. Nothing reports that wait: request timing shows it as unexplained time, and the first signal of a saturated pool is aConnectionTimeoutError. Measuring it today means prepending ontoConnectionPool#checkout.Detail
acquire_connectionnow instruments its blocking poll ascheckout_wait.active_record, with:connection_pooland:checkout_timeoutin the payload. The event's duration is the wait; a checkout that times out still emits it, with the error under:exception.It fires only on the path that blocks on a full pool, after the idle-connection, background-connection, and new-connection attempts have failed, so ordinary checkouts are unaffected. It is emitted outside the pool's lock, except when a checkout falls back to the pool after its pinned connection was discarded.
Documented in the instrumentation guide.
Checklist
[Fix #issue-number]