Skip to content

Emit GenAI exceptions as logs under the opt-in preview#18893

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

Emit GenAI exceptions as logs under the opt-in preview#18893
trask merged 11 commits into
open-telemetry:mainfrom
trask:trask/genai-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), the OpenAI GenAI client instrumentation now emits its exceptions as log records instead of span events.

The AWS SDK GenAI client instrumentation (Bedrock runtime) is wired in the stacked follow-up PR #18894, which keeps all AWS SDK changes (Bedrock=GenAI, DynamoDB=DB, SQS=messaging) together.

Part of follow-up work after #16259.

@trask trask force-pushed the trask/genai-exception-events branch from d945f84 to 9e7abb5 Compare June 3, 2026 18:40
@trask trask force-pushed the trask/genai-exception-events branch from 9e7abb5 to 4603f59 Compare June 3, 2026 20:09
@trask trask changed the title Add GenAI exception event extractor helper Add GenAI exception event extractor wiring Jun 3, 2026
@trask trask changed the title Add GenAI exception event extractor wiring Emit GenAI 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

Updates the OpenAI (GenAI) library instrumentation to customize exception log emission under the opt-in preview mode (otel.semconv.exception.signal.preview=logs), aligning emitted exception logs with the GenAI semantic conventions event name/severity.

Changes:

  • Add GenAiExceptionEventExtractors utility to configure GenAI exception log event name (gen_ai.client.operation.exception) and severity (WARN).
  • Apply the GenAI exception event extractor to OpenAI chat and embeddings instrumenters in OpenAITelemetryBuilder.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
instrumentation/openai/openai-java-1.1/library/src/main/java/io/opentelemetry/instrumentation/openai/v1_1/OpenAITelemetryBuilder.java Wraps OpenAI instrumenter builders to configure GenAI exception log event name/severity under the preview flag.
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/genai/GenAiExceptionEventExtractors.java New shared utility for setting the GenAI exception event extractor on an InstrumenterBuilder.

@trask trask force-pushed the trask/genai-exception-events branch from 4603f59 to 9e5c9e4 Compare June 3, 2026 22:53
@trask trask requested a review from Copilot June 4, 2026 23:10

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

Comment thread instrumentation/openai/openai-java-1.1/library/build.gradle.kts
Comment thread instrumentation/openai/openai-java-1.1/javaagent/build.gradle.kts
@trask trask force-pushed the trask/genai-exception-events branch from 92d92d4 to a4f6a6d Compare June 5, 2026 00:01
@trask trask requested a review from Copilot June 5, 2026 00:22

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

@trask trask force-pushed the trask/genai-exception-events branch from a4f6a6d to 5603c4d Compare June 5, 2026 16:54
@trask trask requested a review from Copilot June 5, 2026 20:51

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

Comment thread instrumentation/openai/openai-java-1.1/library/build.gradle.kts
Comment thread instrumentation/openai/openai-java-1.1/javaagent/build.gradle.kts
@trask trask force-pushed the trask/genai-exception-events branch 2 times, most recently from 0b16e8b to dd30082 Compare June 6, 2026 00:12
@trask trask marked this pull request as ready for review June 6, 2026 00:46
@trask trask requested a review from a team as a code owner June 6, 2026 00:46
@trask trask requested a review from Copilot June 6, 2026 00:46
@trask trask marked this pull request as draft June 6, 2026 00:46

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

@trask trask requested a review from Copilot June 6, 2026 00:56

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

@trask trask force-pushed the trask/genai-exception-events branch from 90a5f60 to 1494fdd Compare June 6, 2026 18:47
@trask trask marked this pull request as ready for review June 6, 2026 18:48
@trask trask requested a review from Copilot June 6, 2026 22:09

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

@trask trask merged commit a7571ea into open-telemetry:main Jun 9, 2026
95 checks passed
@trask trask deleted the trask/genai-exception-events branch June 9, 2026 14:48
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