Skip to content

Emit DB exceptions as logs under the opt-in preview#18889

Merged
laurit merged 9 commits into
open-telemetry:mainfrom
trask:trask/db-exception-events
Jun 9, 2026
Merged

Emit DB exceptions as logs under the opt-in preview#18889
laurit merged 9 commits into
open-telemetry:mainfrom
trask:trask/db-exception-events

Conversation

@trask

@trask trask commented Jun 3, 2026

Copy link
Copy Markdown
Member

Under otel.semconv.exception.signal.preview=logs (introduced in #16259), database client instrumentations now emit their exceptions as log records instead of span events.

Part of follow-up work after #16259.

@trask trask force-pushed the trask/db-exception-events branch from 142d6c7 to 2470400 Compare June 3, 2026 18:36
@trask trask requested a review from Copilot June 3, 2026 19:34

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 adds a small incubating helper in the instrumentation API incubator to standardize configuration of database client exception log events, using the semantic convention event name db.client.operation.exception with WARN severity. This fits alongside existing incubator utilities that help instrumentations align with semantic conventions and emerging exception-as-log behavior introduced in follow-up work to #16259.

Changes:

  • Introduces DbExceptionEventExtractors utility with a helper method to configure an InstrumenterBuilder’s exception event name and severity for DB client exception logs.

@trask trask force-pushed the trask/db-exception-events branch from 2470400 to 82852bc Compare June 3, 2026 19:57
@trask trask changed the title Add DB exception event extractor helper Add DB exception event extractor wiring Jun 3, 2026
@trask trask changed the title Add DB exception event extractor wiring Emit DB exceptions as logs under the opt-in preview Jun 3, 2026
@trask trask requested a review from Copilot June 3, 2026 22:08

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 26 out of 26 changed files in this pull request and generated 1 comment.

@trask trask force-pushed the trask/db-exception-events branch from 82852bc to fcbda86 Compare June 3, 2026 22:44
@trask trask requested a review from Copilot June 3, 2026 23:43

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 26 out of 26 changed files in this pull request and generated 1 comment.

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 30 out of 30 changed files in this pull request and generated no new comments.

@trask trask force-pushed the trask/db-exception-events branch from eb44364 to 34607e8 Compare June 5, 2026 15:12
@trask trask requested a review from Copilot June 5, 2026 16:34

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 30 out of 30 changed files in this pull request and generated no new comments.

@trask trask force-pushed the trask/db-exception-events branch 2 times, most recently from 3d7022d to af3af48 Compare June 5, 2026 16:43

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 30 out of 30 changed files in this pull request and generated no new comments.

@trask trask force-pushed the trask/db-exception-events branch from d8fdfa6 to b88d2e5 Compare June 5, 2026 22:34
@trask trask force-pushed the trask/db-exception-events branch from 9b3e3ee to b88d2e5 Compare June 5, 2026 23:31
@trask trask requested a review from Copilot June 6, 2026 00:19

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 32 out of 32 changed files in this pull request and generated no new comments.

@trask trask marked this pull request as ready for review June 6, 2026 00:52
@trask trask requested a review from a team as a code owner June 6, 2026 00:52
trask added 7 commits June 6, 2026 11:44
The JDBC exception signal log test used waitAndAssertLogRecords(), which
expects the captured log list to contain only the asserted records. In these
test runs, unrelated JDBC driver or pool logs can be captured first, and the
logged exception class/message can be normalized differently from the thrown
SQLException subtype.

Restore filtering to the db.client.operation.exception log record and assert
that the exception attributes are present instead of matching the exact thrown
exception values.

Validation: .\gradlew.bat :instrumentation:jdbc:library:testExceptionSignalLogs :instrumentation:jdbc:javaagent:testExceptionSignalLogs --no-build-cache
@trask trask force-pushed the trask/db-exception-events branch from b88d2e5 to 9d22c5d Compare June 6, 2026 18:44
@trask trask requested a review from Copilot June 6, 2026 22:08

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 30 out of 30 changed files in this pull request and generated 1 comment.

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 30 out of 30 changed files in this pull request and generated no new comments.

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 30 out of 30 changed files in this pull request and generated no new comments.

@laurit

laurit commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

aws dynamodb instrumentation also implements db semconv, but it doesn't use the DbClientAttributesExtractor

@laurit laurit merged commit b31e8f9 into open-telemetry:main Jun 9, 2026
97 checks passed
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