Skip to content

Add DB client collection semconv API#18989

Merged
trask merged 1 commit into
open-telemetry:mainfrom
trask:db-client-semconv-api
Jun 15, 2026
Merged

Add DB client collection semconv API#18989
trask merged 1 commit into
open-telemetry:mainfrom
trask:db-client-semconv-api

Conversation

@trask

@trask trask commented Jun 14, 2026

Copy link
Copy Markdown
Member

Add DB client hooks for separating stable db.collection.name / db.namespace and old db.operation from stable db.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.

Copilot AI left a comment

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.

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.name and legacy db.operation through DbClientAttributesGetter and DbClientAttributesExtractor.
  • Updated DB span-name extraction to prefer db.collection.name over db.namespace for 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 trask force-pushed the db-client-semconv-api branch from 90944e7 to e11e6d2 Compare June 14, 2026 03:16
@trask trask marked this pull request as draft June 14, 2026 03:36
@trask trask force-pushed the db-client-semconv-api branch 2 times, most recently from 5bbc6bc to af23dee Compare June 14, 2026 23:52
@trask trask requested a review from Copilot June 15, 2026 00:01

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

@trask trask force-pushed the db-client-semconv-api branch 2 times, most recently from 1a84392 to 68c9f17 Compare June 15, 2026 00:25
@trask trask requested a review from Copilot June 15, 2026 00:26

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

operationName = "DROP DATABASE";
} else {
operationName = "WRITE";
operationName = methodName;

@trask trask Jun 15, 2026

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.

changing this one because it's just a method name (and the method doesn't result in sending "sql" like the two above)

@trask trask marked this pull request as ready for review June 15, 2026 02:00
@trask trask marked this pull request as draft June 15, 2026 02:33
@trask trask force-pushed the db-client-semconv-api branch from 68c9f17 to 23e198a Compare June 15, 2026 03:08
@trask trask force-pushed the db-client-semconv-api branch from 23e198a to 91368ad Compare June 15, 2026 03:12

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

@trask trask marked this pull request as ready for review June 15, 2026 03:34
@trask trask merged commit 015bdde into open-telemetry:main Jun 15, 2026
95 checks passed
@trask trask deleted the db-client-semconv-api branch June 15, 2026 14:52
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.

3 participants