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: Extend the DBStats struct #26633

Closed
frojasg opened this issue Jul 26, 2018 · 6 comments
Closed

proposal: database/sql: Extend the DBStats struct #26633

frojasg opened this issue Jul 26, 2018 · 6 comments

Comments

@frojasg
Copy link
Contributor

@frojasg frojasg commented Jul 26, 2018

The method db.Stats() exposes the DBStats struct that only has the number of connection open.
I would like to include:

  • The number of active connections: db.numOpen - len(db.freeConn)
  • The number of connection requests: len(db.connRequests)
@gopherbot gopherbot added this to the Proposal milestone Jul 26, 2018
@gopherbot gopherbot added the Proposal label Jul 26, 2018
@derekperkins
Copy link

@derekperkins derekperkins commented Jul 26, 2018

This would be great to export as a metric. We don't have any insight into what the right size of our connection pools should be, and it's even harder to debug delays when we think that queries are waiting for an open connection.

@kardianos
Copy link
Contributor

@kardianos kardianos commented Jul 27, 2018

Please inspect tip: https://tip.golang.org/pkg/database/sql/#DBStats

Does this solve your need?

@derekperkins
Copy link

@derekperkins derekperkins commented Jul 27, 2018

That's perfect. Thanks @kardianos!

@frojasg
Copy link
Contributor Author

@frojasg frojasg commented Jul 27, 2018

yep, that looks good to me

@frojasg frojasg closed this Jul 27, 2018
@frojasg
Copy link
Contributor Author

@frojasg frojasg commented Jul 27, 2018

is this going to be included in go 1.11? I don't see it here https://tip.golang.org/doc/go1.11

@kardianos
Copy link
Contributor

@kardianos kardianos commented Jul 27, 2018

It will be in go1.11.

I didn't put it in the release notes.

@golang golang locked and limited conversation to collaborators Jul 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.