I build Ritele, so this covers how it handles connection pools. First published on the Ritele blog.
When a service slows down, "the database is slow" is an easy first guess. Sometimes it is the database. Sometimes the database is fine, and your service is waiting for a connection from its own pool. From where the user sits, the two look the same: requests take longer, and some time out.
This post covers why a full connection pool looks like a slow database, the OpenTelemetry metrics that tell the two apart, and what Ritele does with them.
Why a full pool looks like a slow database
Every service that talks to Postgres keeps a pool of connections. When all of them are in use, the next request waits for one to come free. That wait shows up as a slow database call, even when the database itself has room to spare.
Traces alone can't settle it. A span tells you a query took two seconds; it doesn't say how many of the pool's connections were in use, or that requests were queueing for one. For that you need the pool's own metrics.
The metrics that tell them apart
OpenTelemetry has standard database-client metrics for connection pools. Ritele reads these, and the older db.client.connections.* names too:
| Metric | What it tells you |
|---|---|
db.client.connection.count, split by db.client.connection.state
|
Connections in use, and connections open but idle |
db.client.connection.max |
The pool's ceiling |
db.client.connection.pending_requests |
Requests waiting for a connection |
db.client.connection.wait_time |
How long they waited |
The one to watch is requests waiting. Above zero, some requests are waiting for a connection rather than for the database.
What Ritele does with them
It files each pool under the database it reaches. Ritele reads the pool's name as host:port/database and matches it to a database the service is already seen calling. A pool it can't place on exactly one database is dropped, not guessed.
It totals a shared database across its callers. Select a Postgres node on the map, and its side panel shows What it is holding: connections held, in use, idle and requests waiting, summed across every service that calls it, with how many callers it counted. The ceiling is the sum of those callers' own pool sizes, not the database's max_connections, and the page says so: "Callers and component are separate readings and are never added: one caller's pool of ten is not the component's limit of a hundred."

A Postgres database's 'What it is holding' panel in a Ritele test install.
It checks every service's fullest pool. Each service gets a health check called DB pool use. It turns Degraded at 85% of the service's fullest pool, and Unhealthy only at 98% with at least one request actually waiting. A pool at 98% with nothing waiting stays Degraded. The check looks at a 5-minute window, needs 3 of the last 5 one-minute evaluations to change status, and 5 in a row to clear. The reason reads plainly: "Using 9 of 10 database connections; 4 requests waiting."
It tells you which pool runs out first. Headroom names the pool that runs out first at your 7-day peak, for example: "Headroom: 2.3× your 7-day peak — its pool to postgresql:ref runs out first."
What it doesn't do
- Pool pressure never turns the database itself Degraded or Unhealthy. The check is on each service; the database's own check reads its server-side connections.
- There's no alert on wait time alone, on timeouts, or on slow connection creation.
- It doesn't infer pool sizes from traces, and doesn't forecast when a pool will run out.
- If one pool is reported under two different names, it's counted twice.
Turning it on
Pool metrics are opt-in: your services need to emit them, with metrics export on. If your database client already emits the db.client.connection.* metrics, there's nothing to change. Name each pool host:port/database so Ritele can place it.
Connection pools are on every Ritele plan, Free included. ritele.io
Top comments (0)