feat(users/Profpatsch/whatcd-resolver): more otel traces

Change-Id: I5094b64f202eeedb57510a25850bba2edd9ec36f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9725
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
This commit is contained in:
Profpatsch 2023-10-14 19:53:43 +02:00 committed by clbot
parent cc040a5ad3
commit 8e811fe625
3 changed files with 273 additions and 117 deletions

View file

@ -194,7 +194,7 @@ data PoolingInfo = PoolingInfo
unusedResourceOpenTime :: Seconds,
-- | Max number of resources that can be
-- in the Pool at any time
maxOpenResourcesPerStripe :: AtLeast 1 Int
maxOpenResourcesAcrossAllStripes :: AtLeast 1 Int
}
deriving stock (Generic, Eq, Show)
deriving anyclass (FromJSON)
@ -218,12 +218,14 @@ initMonadPostgres logInfoFn connectInfo poolingInfo = do
createPGConnPool ::
IO (Pool Postgres.Connection)
createPGConnPool =
Pool.createPool
poolCreateResource
poolfreeResource
poolingInfo.numberOfStripes.unAtLeast
(poolingInfo.unusedResourceOpenTime & secondsToNominalDiffTime)
(poolingInfo.maxOpenResourcesPerStripe.unAtLeast)
Pool.newPool $
Pool.defaultPoolConfig
{- resource init action -} poolCreateResource
{- resource destruction -} poolfreeResource
( poolingInfo.unusedResourceOpenTime.unSeconds
& fromIntegral @Natural @Double
)
(poolingInfo.maxOpenResourcesAcrossAllStripes.unAtLeast)
where
poolCreateResource = Postgres.connect connectInfo
poolfreeResource = Postgres.close