Skip to content

Add getDbName() to DbClientAttributesGetter to better support old / stable semconv split#16318

Merged
trask merged 1 commit intoopen-telemetry:mainfrom
trask:pr1-semconv-getDbName
Mar 2, 2026
Merged

Add getDbName() to DbClientAttributesGetter to better support old / stable semconv split#16318
trask merged 1 commit intoopen-telemetry:mainfrom
trask:pr1-semconv-getDbName

Conversation

@trask
Copy link
Member

@trask trask commented Feb 27, 2026

This will allow instrumentations to emit different values for db.name (old semconv) and db.namespace (new semconv), which is needed for a few databases where these values are different (e.g. postgresql, sqlserver).

Add a deprecated getDbName() default method to DbClientAttributesGetter
that allows instrumentations to return a different value for the old
db.name attribute vs the new db.namespace attribute.

Use getDbName() in DbClientAttributesExtractor (for DB_NAME) and
DbClientSpanNameExtractor (for old semconv span names) instead of
getDbNamespace().

The default implementation delegates to getDbNamespace() so existing
instrumentations are unaffected.
@trask trask force-pushed the pr1-semconv-getDbName branch from c5f5054 to 7b49b49 Compare February 27, 2026 19:27
@trask trask marked this pull request as ready for review February 27, 2026 20:13
@trask trask requested a review from a team as a code owner February 27, 2026 20:13
*/
@Deprecated // to be removed in 3.0
@Nullable
default String getDbName(REQUEST request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess an alternative would be to se an internal interface

Copy link
Member Author

Choose a reason for hiding this comment

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

Similar to #16304 (comment), I kind of like making it public to support anyone outside of this repo going through the transition, although maybe that's not too realistic since they'd have to stick to our timeline as we'll be removing them in 3.0

@trask trask merged commit 39640f9 into open-telemetry:main Mar 2, 2026
93 checks passed
@trask trask deleted the pr1-semconv-getDbName branch March 2, 2026 15:14
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.

2 participants