GoogleCloudPlatform / GoogleCloudPlatform/cloud-sql-proxy

Add total connections metric

Aperta
#2,518 0 commenti 3 reazioni 1 assegnatario Rivendicata da @hessjcg Vedi su GitHub
type: feature request
Lingua principale
Go
Stelle
1.4k
Fork
352
Merge medio
14h 54m
PR unite (30g)
5

Descrizione

### 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_

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.