How to monitor the total number of pool connections available, busy and in query?

GoodDay

I trust everyone is well!
I am trying to find a way to monitor the total number of pool connections available, busy and in query. Any form of assistance will be greatly appriciated.

Thank you.

Pool connections of what? There can be many pools of things in an application.

Ecto pool connections

There’s no API for that on DBConnection. Your best bet it to attach to telemetry and watch :idle_time (as well as the other measurements) over time.

1 Like

You can create a connection listener and gather some connection data from that. https://github.com/elixir-ecto/db_connection/blob/master/lib/db_connection.ex#L477

2 Likes

There is a PR is DB Connection related to this Add metrics for connection pool usage by peixian · Pull Request #292 · elixir-ecto/db_connection · GitHub

1 Like