open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Share strict database server port parsing
@trask is already working on this.
Since Sep 10, 2026.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1.2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
R2DBC, ClickHouse, and Redis each contain nearly identical parsing for configured database server ports. Keeping separate copies makes their validation rules easy to drift.
Describe the solution you'd like
Add a shared DbServerEndpointUtil.parsePort(String) helper that accepts only ASCII decimal ports in the range 1..65535. Reuse it from R2dbcServerTarget, ClickHouseClientV2Singletons, and RedisServerTarget.
Describe alternatives you've considered
Leave the parsers local, or migrate every existing port parser at once. The older JDBC, HBase, Couchbase, and OpenSearch helpers have different contracts for trimming, range checks, logging, and sentinel values, so changing those should be considered separately.
Additional context
Follow-up to the review discussion in #19981: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/19981#discussion_r3976844555
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
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.