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

Metric for number of open connections #49

Closed
wants to merge 18 commits into from

Conversation

nhyne
Copy link
Contributor

@nhyne nhyne commented May 23, 2022

Adding an open_connections metric to track the number of connections currently open in the pool.

Is this name for the metric okay or should it be camel case and/or named something different?

I think this closes #6 but if I missed something let me know.

@jdegoes
Copy link
Member

jdegoes commented May 25, 2022

Let's do zio_jdbc_open_connections and make taht a convention going forward.

@@ -26,6 +26,8 @@ import java.sql.Connection
*/
final case class ZConnectionPool(transaction: ZLayer[Any, Throwable, ZConnection])
object ZConnectionPool {
private[jdbc] val connectionsCounter = zio.metrics.Metric.counterInt("zio_jdbc_open_connections")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need a Gauge here because some metric systems do not allow incrementing by negative numbers.

Otherwise, looks good to merge!

@jdegoes jdegoes closed this Aug 18, 2022
@jdegoes jdegoes reopened this Aug 18, 2022
@jdegoes
Copy link
Member

jdegoes commented Oct 24, 2022

@nhyne Please re-open when you are ready for this to be merged!

@jdegoes jdegoes closed this Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add metrics to track database connection failures / successes
2 participants