We have a web app running on .NET 6 in Azure on a Linux app service plan.
The application uses multiple different databases/connection strings to Azure SQL databases.
We’ve seen this exception in our logs, all in context of one specific database:
System.InvalidOperationException Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached
I’m interested in keeping logging some metrics about the connection pool, in order to see if there is a pattern of these connections leaking slowly over time, or all at once.
Looking at the event counters, it seems that the number for connections are across all pools, and would not allow me to keep track of the pool for a specific connection string.
Is there a way to extract information about the connection pool for a specific connection string? Or even loop through pools and get information about them?
5