Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: database/sql: add MaxIdleConnections to DBStats #52567

Open
bonnefoa opened this issue Apr 26, 2022 · 2 comments
Open

proposal: database/sql: add MaxIdleConnections to DBStats #52567

bonnefoa opened this issue Apr 26, 2022 · 2 comments

Comments

@bonnefoa
Copy link

This is a proposal to add MaxIdleConnections to DBStats.

Currently, DBStats exports the following metrics:

type DBStats struct {
    MaxOpenConnections int // Maximum number of open connections to the database.

    // Pool Status
    OpenConnections int // The number of established connections both in use and idle.
    InUse           int // The number of connections currently in use.
    Idle            int // The number of idle connections.

    // Counters
    WaitCount         int64         // The total number of connections waited for.
    WaitDuration      time.Duration // The total time blocked waiting for a new connection.
    MaxIdleClosed     int64         // The total number of connections closed due to SetMaxIdleConns.
    MaxIdleTimeClosed int64         // The total number of connections closed due to SetConnMaxIdleTime.
    MaxLifetimeClosed int64         // The total number of connections closed due to SetConnMaxLifetime.
}

We had issues where our applications were configured with a MaxOpenConnections != MaxIdleConnections, leading to a lot of connection churning to the DB.
MaxOpenConnections is already available in the stats but MaxIdleConnections is missing, making it hard to track affected applications.

@gopherbot gopherbot added this to the Proposal milestone Apr 26, 2022
@gopherbot
Copy link

Change https://go.dev/cl/402334 mentions this issue: database/sql: Add MaxIdleConnections to DBStats

@ianlancetaylor ianlancetaylor changed the title proposal: database/sql: Add MaxIdleConnections to DBStats proposal: database/sql: add MaxIdleConnections to DBStats Apr 26, 2022
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Apr 26, 2022
@kardianos
Copy link
Contributor

I'm okay with this proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

3 participants