-
Notifications
You must be signed in to change notification settings - Fork 839
Change OpenTelemetryChatClient/EmbeddingGenerator to log raw additional properties #6776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…al properties For historical reasons (based on older versions of the genai convention), we were mangling the key names. Now just use the key names as sourced from the dictionary, enabling a developer to more easily augment the spans with data of their choice.
There was a problem hiding this comment.
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 simplifies OpenTelemetry logging by removing key name mangling and using raw property names from additional properties dictionaries. Previously, the code was transforming key names using snake_case conversion and provider-specific prefixes, but now it logs additional properties with their original key names.
- Removed provider-specific tag prefixes and snake_case conversion for additional properties
- Updated test assertions to expect raw key names instead of mangled ones
- Cleaned up unused helper methods and imports
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
OpenTelemetryChatClient.cs | Simplified additional properties logging to use raw key names |
OpenTelemetryEmbeddingGenerator.cs | Simplified additional properties logging to use raw key names |
OpenTelemetryConsts.cs | Removed unused PerProvider helper methods |
OpenTelemetryChatClientTests.cs | Updated test assertions for new raw key format |
OpenTelemetryEmbeddingGeneratorTests.cs | Updated test assertions for new raw key format |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/Libraries/Microsoft.Extensions.AI/Embeddings/OpenTelemetryEmbeddingGenerator.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/Embeddings/OpenTelemetryEmbeddingGenerator.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could someone consider this to be a breaking change if they were doing post-processing on the keys or otherwise relying on the key names in the old structure?
Yes, but a) these pale in comparison to the changes made for the 1.37 update, and b) the whole impl is under an Experimental otel namespace because the spec is still changing. |
…al properties (#6776) For historical reasons (based on older versions of the genai convention), we were mangling the key names. Now just use the key names as sourced from the dictionary, enabling a developer to more easily augment the spans with data of their choice.
For historical reasons (based on older versions of the genai convention), we were mangling the key names. Now just use the key names as sourced from the dictionary, enabling a developer to more easily augment the spans with data of their choice.
#6771
Microsoft Reviewers: Open in CodeFlow