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
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@frojasg
Copy link
Contributor

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
@derekperkins
Copy link

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

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

Does this solve your need?

@kardianos kardianos added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 27, 2018
@derekperkins
Copy link

That's perfect. Thanks @kardianos!

@frojasg
Copy link
Contributor Author

frojasg commented Jul 27, 2018

yep, that looks good to me

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

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

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.
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants