Skip to content

Add db.system.name support to r2dbc#16251

Merged
trask merged 6 commits intoopen-telemetry:mainfrom
trask:r2dbc-db-system
Mar 2, 2026
Merged

Add db.system.name support to r2dbc#16251
trask merged 6 commits intoopen-telemetry:mainfrom
trask:r2dbc-db-system

Conversation

@trask
Copy link
Copy Markdown
Member

@trask trask commented Feb 21, 2026

No description provided.

@trask trask marked this pull request as ready for review February 21, 2026 20:59
@trask trask requested a review from a team as a code owner February 21, 2026 20:59
# Conflicts:
#	instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesExtractor.java
Comment on lines 74 to 81
this.system =
originalConnection != null
? originalConnection
.getMetadata()
.getDatabaseProductName()
.toLowerCase(Locale.ROOT)
.split(" ")[0]
: OTHER_SQL;
Copy link
Copy Markdown
Member Author

@trask trask Feb 23, 2026

Choose a reason for hiding this comment

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

db.system is currently captured in not the best way

This PR adds db.system.name, based on the jdbc url's "driver" component similar to jdbc instrumentation.

It adds DbClientAttributesGetter.getDbSystem() in order to support both old and new.

Copy link
Copy Markdown
Contributor

@laurit laurit Feb 25, 2026

Choose a reason for hiding this comment

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

Wondering whether this is necessary. The current convention seems to be that getDbSystemName returns the old value that is mapped to the new value in DbClientAttributesExtractor (but not in DbClientSpanNameExtractor.computeSpanNameStable). Perhaps we should start returning stable values from getDbSystemName and reverse the mapping?
Could also drop the old logic for getting the db system name.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree we could make this behavioral breaking change without a major version bump as it's a bug fix.

My general thought with the database semconv changes has been to try to leave existing untouched and only fix things under the stable semconv flag.

Semi-related, I was planning to remove the centralized mapping out of the Instrumentation API (see also in #16277), under the idea that the Instrumentation API shouldn't know about the individual conventions for cassandra, elasticsearch, postresql, mysql, etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my opinion having the mapping in the instrumentation api is fine since it is only for transition, having it in one place could make removing it easier.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

also similar to #16304 (comment), this supports external instrumentations to control the mapping used (again though may not be super realistic scenario since they'd have to stick to our timeline as we'll be removing the support in 3.0)

@github-actions github-actions Bot added the test native This label can be applied to PRs to trigger them to run native tests label Feb 25, 2026
@trask trask merged commit 45d8c7f into open-telemetry:main Mar 2, 2026
95 checks passed
@trask trask deleted the r2dbc-db-system branch March 2, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test native This label can be applied to PRs to trigger them to run native tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants