Conversation
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.
Implicit pool queries and
Pool::begin()currently bypass the wrapper's acquisition metrics by using the raw SQLx pool. Separately, dropping an in-flightacquire()leavesdb.client.connection.pending_requestsincremented. A workload using ordinaryquery(...).fetch_*(&pool)can therefore saturate the pool without reporting its waits/timeouts, while caller cancellation leaves a stale pending count.Route plain, annotated, streaming, prepare/describe and transaction acquisition through the same instrumented
Pool::acquire(). A private executor runs the query on the acquired raw connection, retaining the existing outer query instrumentation so spans and operation metrics are recorded once. An owned usage guard follows the connection into a transaction until commit, rollback or drop.Acquisition accounting:
PoolTimedOutincrements timeouts.Regression tests cover acquisition counts, absence of duplicate query spans, transaction lease duration, cancellation versus real pool timeouts across acquisition paths, and release after dropping a partially consumed stream.
Validation (Rust 1.97.1, SQLx 0.9):
cargo test --all-features --workspace— 569 passed, 1 existing ignored doc example; includes real PostgreSQL 15 and MySQL 8 containers.cargo test --features "sqlite,runtime-async-std" --test pool_metrics— 15 passed.cargo clippy --all-targets --all-features -- -D warningsandcargo fmt --all -- --check— passed.Based directly on
trunk; independent of the owned-transaction lifetime fix in #39.