From 12b37f32185bc1fdd7cc37c2830cffface137028 Mon Sep 17 00:00:00 2001 From: Vamshi Aruru Date: Thu, 26 Dec 2024 13:46:49 +0530 Subject: [PATCH] Expose puddle.Pool's EmptyAcquireWaitTime in pgxpool's Stats Addresses: https://github.com/jackc/pgx/issues/2205 --- pgxpool/stat.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pgxpool/stat.go b/pgxpool/stat.go index cfa0c4c56..e02b6ac39 100644 --- a/pgxpool/stat.go +++ b/pgxpool/stat.go @@ -82,3 +82,10 @@ func (s *Stat) MaxLifetimeDestroyCount() int64 { func (s *Stat) MaxIdleDestroyCount() int64 { return s.idleDestroyCount } + +// EmptyAcquireWaitTime returns the cumulative time waited for successful acquires +// from the pool for a resource to be released or constructed because the pool was +// empty. +func (s *Stat) EmptyAcquireWaitTime() time.Duration { + return s.s.EmptyAcquireWaitTime() +}