Skip to content

Add total connections metric #2518

@Stono

Description

@Stono

Feature Description

Hi,
Following on from the very old issue (#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

Metadata

Metadata

Assignees

Labels

type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions