GoogleCloudPlatform / GoogleCloudPlatform/cloud-sql-proxy

Add total connections metric

Abierto
#2,518 0 comentarios 3 reacciones 1 asignado Reclamado por @hessjcg Ver en GitHub
type: feature request
Lenguaje dominante
Go
Estrellas
1.4k
Forks
352
Merge medio
14 h 54 min
PR fusionados (30 d)
5

Descripción

### Feature Description

Hi,
Following on from the very old issue (https://github.com/GoogleCloudPlatform/cloud-sql-proxy/issues/1871) - connection churn is still a real problem when using cloudsql-proxy & IAM.

I'm hesitant to introduce pgbouncer globally as a mitigation, because it'll be confusing for our devs who are configuring their app pools, and observing their postgres servers (they'll not be in control of the proxy).

This then leads me instead towards a softer approach where i'm able to highlight to people when they have a high amount of connection churn. So for example we want to encourage people to create connection pools with a min+max the same, and keep alive on the connections, in order to mitigate latency.

The current metrics don't enable us to do that, we only have `cloudsqlconn_open_connections` which is the open connections at a point in time. We had an issue today where every 10 minutes 80% of the idle connections were being reconnected (at once) due to an idleTimeout configured, this was subsequently service impacting. This didn't appear in this metric because the same didn't happen at the exact time they were recreated.

I propose adding `cloudsqlconn_total_connections` as an ever incrementing counter, this will enable us to trivially track how many connections people make over a period (thus allowing us to detect sub optimal connection pooling configurations - eg where their min connections are too low, or their idle ttl too high).

### Sample code

_No response_

### Alternatives Considered

_No response_

### Additional Details

_No response_

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.