sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

feat: metric observer & pool wait timing

Open domodwyer opened this issue 3 years ago • 1 comments

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.
    

domodwyer avatar Jun 09 '22 17:06 domodwyer

I think this is good for another pass :+1:

domodwyer avatar Jun 10 '22 13:06 domodwyer