Emit GenAI exceptions as logs under the opt-in preview#18893
Merged
Conversation
d945f84 to
9e7abb5
Compare
9e7abb5 to
4603f59
Compare
Contributor
There was a problem hiding this comment.
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
GenAiExceptionEventExtractorsutility 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. |
4603f59 to
9e5c9e4
Compare
92d92d4 to
a4f6a6d
Compare
a4f6a6d to
5603c4d
Compare
0b16e8b to
dd30082
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
90a5f60 to
1494fdd
Compare
laurit
approved these changes
Jun 9, 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.
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.