sqlx
sqlx copied to clipboard
feat: metric observer & pool wait timing
This PR implements observer-based Pool metric instrumentation, and captures the time taken to acquire a connection permit from the connection pool.
A follow-on from https://github.com/launchbadge/sqlx/pull/1860.
-
feat: metric observer & pool wait timing (b7e797e6)
This commit adds the public PoolMetricsObserver trait for end users to optionally implement, in order to receive metric / event data from the underlying connection Pool. PoolMetricsObserver currently exposes a single metric: the duration of time spent waiting for a permit from the connection pool semaphore. This allows users to quantify the saturation of the connection pool (USE-style metrics) and identify when the workload exceeds the available pool capacity. A default no-op method implementation is provided so end-users can choose which metrics they care about, and not have to implement the full set of methods.
I think this is good for another pass :+1: