Add DB client collection semconv API#18989
Merged
Merged
Conversation
This was referenced Jun 14, 2026
This was referenced Jun 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the incubating DB client semantic-conventions API to separate stable db.collection.name / db.namespace and stable db.operation.name from the legacy db.operation, enabling instrumentations to preserve old semantic-convention values while emitting stable collection names and stable span names via shared helpers.
Changes:
- Added support for extracting/emitting stable
db.collection.nameand legacydb.operationthroughDbClientAttributesGetterandDbClientAttributesExtractor. - Updated DB span-name extraction to prefer
db.collection.nameoverdb.namespacefor stable semconv. - Updated/expanded tests to cover the new collection-name behavior and the legacy/stable operation split.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientSpanNameExtractorTest.java | Updates span-name expectations and adds coverage for preferring collection name over namespace. |
| instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesExtractorTest.java | Extends attribute extraction tests to include db.collection.name and legacy db.operation. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java | Adjusts SQL getter defaults/docs in support of derived operation/collection values. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientSpanNameExtractor.java | Updates stable span-name target selection to use db.collection.name as the preferred target. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesGetter.java | Introduces legacy getDbOperation() and stable getDbCollectionName() hooks on the shared DB getter. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesExtractor.java | Emits stable db.collection.name and uses legacy db.operation when emitting old semconv attributes. |
trask
force-pushed
the
db-client-semconv-api
branch
from
June 14, 2026 03:16
90944e7 to
e11e6d2
Compare
trask
marked this pull request as draft
June 14, 2026 03:36
trask
force-pushed
the
db-client-semconv-api
branch
2 times, most recently
from
June 14, 2026 23:52
5bbc6bc to
af23dee
Compare
trask
force-pushed
the
db-client-semconv-api
branch
2 times, most recently
from
June 15, 2026 00:25
1a84392 to
68c9f17
Compare
trask
commented
Jun 15, 2026
| operationName = "DROP DATABASE"; | ||
| } else { | ||
| operationName = "WRITE"; | ||
| operationName = methodName; |
Member
Author
There was a problem hiding this comment.
changing this one because it's just a method name (and the method doesn't result in sending "sql" like the two above)
trask
marked this pull request as ready for review
June 15, 2026 02:00
trask
marked this pull request as draft
June 15, 2026 02:33
trask
force-pushed
the
db-client-semconv-api
branch
from
June 15, 2026 03:08
68c9f17 to
23e198a
Compare
trask
force-pushed
the
db-client-semconv-api
branch
from
June 15, 2026 03:12
23e198a to
91368ad
Compare
trask
marked this pull request as ready for review
June 15, 2026 03:34
laurit
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add DB client hooks for separating stable
db.collection.name/db.namespaceand olddb.operationfrom stabledb.operation.name. This lets database instrumentations preserve old semantic convention values while emitting stable collection names and stable span names through the shared DB client API.