open-telemetry / open-telemetry/opentelemetry-python-contrib
sqlalchemy: modernize`db.client.connection.count` metric
@ahmed5145 is already working on this.
Since Sep 17, 2026.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
What problem do you want to solve?
UPDATED description
SQLAlchemy instrumentor is not emitting metric connection count. It is instead emitting deprecated metric usage.
Original description
Click here to expand
Noted in https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1158#issuecomment-5623559405:One concrete starting point: SQLAlchemy already reports connection usage, but under the deprecated
db.client.connections.usagename (connections_usage) rather than the currentdb.client.connection.count. Migrating that toconnection.countwithstate=idle/used, then adding the other pool metrics SQLAlchemy can see from its pool events, is a well-scoped first task.
It would be consistent if support of current/stable metric connection count (away from deprecated metric usage) was also an opt-in with OTEL_SEMCONV_STABILITY_OPT_IN like the span attributes, introduced in https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4110.
Describe the solution you'd like
Update opentelemetry-instrumentation-sqlalchemy to emit db.client.connection.count, replacing db.client.connections.usage.
Describe alternatives you've considered
We considered doing an opt-in but upon discussion agreed that the opt-in env var for span attribute migration is not appropriate for this -- see comment.
Additional Context
No response
Would you like to implement a fix?
No response
Tip
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.