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

Add postgres connection pool instrumentation #1246

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

evankanderson
Copy link
Member

@evankanderson evankanderson commented Oct 19, 2023

I was looking at https://opentelemetry.io/ecosystem/registry/?s=sql&component=&language=go and saw that splunk had some pq bindings.

Per https://pkg.go.dev/github.com/signalfx/splunk-otel-go/instrumentation/database/sql/splunksql#section-readme, this only includes the following metrics, no distributions / error rates on SQL queries:

db.client.connections.usage ({connection}) - The number of connections that are currently in state described by the state attribute
db.client.connections.max ({connection}) - The maximum number of open connections allowed
db.client.connections.wait_time (ms) - The time it took to obtain an open connection from the pool

@evankanderson
Copy link
Member Author

Sample metrics from Docker Compose:

# HELP mediator_db_client_connections_max The maximum number of open connections allowed
# TYPE mediator_db_client_connections_max gauge
mediator_db_client_connections_max{otel_scope_name="github.com/signalfx/splunk-otel-go/instrumentation/database/sql/splunksql",otel_scope_version="1.9.0",pool_name="dbname=mediator host=postgres port=5432 sslmode=disable user=postgres"} 0
# HELP mediator_db_client_connections_usage The number of connections that are currently in state described by the state attribute
# TYPE mediator_db_client_connections_usage gauge
mediator_db_client_connections_usage{otel_scope_name="github.com/signalfx/splunk-otel-go/instrumentation/database/sql/splunksql",otel_scope_version="1.9.0",pool_name="dbname=mediator host=postgres port=5432 sslmode=disable user=postgres",state="idle"} 1
mediator_db_client_connections_usage{otel_scope_name="github.com/signalfx/splunk-otel-go/instrumentation/database/sql/splunksql",otel_scope_version="1.9.0",pool_name="dbname=mediator host=postgres port=5432 sslmode=disable user=postgres",state="used"} 0
# HELP mediator_db_client_connections_wait_time_milliseconds The time it took to obtain an open connection from the pool
# TYPE mediator_db_client_connections_wait_time_milliseconds gauge
mediator_db_client_connections_wait_time_milliseconds{otel_scope_name="github.com/signalfx/splunk-otel-go/instrumentation/database/sql/splunksql",otel_scope_version="1.9.0",pool_name="dbname=mediator host=postgres port=5432 sslmode=disable user=postgres"} 0

@JAORMX JAORMX merged commit 8b4e69a into stacklok:main Oct 20, 2023
12 checks passed
@JAORMX JAORMX deleted the auto-pg-instrument branch October 20, 2023 04:41
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.

None yet

2 participants