Update to 1.38 of the otel genai standard convention#6981
Merged
stephentoub merged 1 commit intodotnet:mainfrom Oct 30, 2025
Merged
Update to 1.38 of the otel genai standard convention#6981stephentoub merged 1 commit intodotnet:mainfrom
stephentoub merged 1 commit intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the OpenTelemetry implementations in Microsoft.Extensions.AI to align with the Semantic Conventions for Generative AI systems v1.38. The key changes include refactoring how content parts are serialized for telemetry, introducing specific part types (blob, uri, file) to replace the generic representation, and adding a new comprehensive test to verify all official OpenTelemetry content part types are serialized correctly.
- Updates version references from v1.37 to v1.38 in documentation comments
- Introduces three new structured part types (
OtelBlobPart,OtelUriPart,OtelFilePart) to replace generic serialization - Adds
DeriveModalityFromMediaTypehelper method to extract modality from MIME types - Adds comprehensive test coverage for all official OpenTelemetry content part types in both streaming and non-streaming scenarios
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| OpenTelemetryChatClient.cs | Core implementation changes: adds new part types, modality derivation logic, and updates serialization to use structured formats per OpenTelemetry v1.38 spec |
| OpenTelemetryImageGenerator.cs | Updates version reference in documentation from v1.37 to v1.38 |
| OpenTelemetryEmbeddingGenerator.cs | Updates version reference in documentation from v1.37 to v1.38 |
| OpenTelemetrySpeechToTextClient.cs | Updates version reference in documentation from v1.37 to v1.38 |
| OpenTelemetryChatClientTests.cs | Adds comprehensive test verifying all official content part types serialize correctly; updates existing test expectations for new serialization format |
| OpenTelemetryImageGeneratorTests.cs | Updates test expectations to match new serialization format with blob, uri, and file part types |
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs
Show resolved
Hide resolved
eiriktsarpalis
approved these changes
Oct 30, 2025
Member
Author
|
@JamesNK, now that there's an official standard for it, it'd be cool if Aspire could render blobs/uris with appropriate media types. |
1 task
jeffhandley
pushed a commit
to jeffhandley/extensions
that referenced
this pull request
Nov 1, 2025
jeffhandley
pushed a commit
that referenced
this pull request
Nov 2, 2025
This was referenced Nov 11, 2025
Merged
Merged
This was referenced Nov 26, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.38.0
These blob, file, and uri parts just got added to the spec earlier today and were the only updates for 1.38 we didn't yet incorporate.
Microsoft Reviewers: Open in CodeFlow