-
Notifications
You must be signed in to change notification settings - Fork 839
Add otel middleware for IImageGenerator #6809
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
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
Adds OpenTelemetry instrumentation middleware for IImageGenerator following the OpenTelemetry Semantic Conventions for Generative AI systems. This enables telemetry data collection and observability for image generation operations.
- Implements OpenTelemetryImageGenerator with comprehensive activity tracking, metrics collection, and usage reporting
- Adds builder extensions to integrate OpenTelemetry into the image generator pipeline
- Enhances data models to support usage details and additional properties for telemetry
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/Libraries/Microsoft.Extensions.AI.Tests/Image/OpenTelemetryImageGeneratorTests.cs | Comprehensive test coverage for OpenTelemetry image generator functionality |
test/Libraries/Microsoft.Extensions.AI.Tests/Image/ImageGeneratorBuilderTests.cs | Tests for the image generator builder pattern |
src/Libraries/Microsoft.Extensions.AI/OpenTelemetryConsts.cs | Adds constants for image telemetry and choice count tracking |
src/Libraries/Microsoft.Extensions.AI/Embeddings/OpenTelemetryEmbeddingGenerator.cs | Fixes token usage histogram to include tags |
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryImageGeneratorBuilderExtensions.cs | Builder extensions for adding OpenTelemetry to image generators |
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryImageGenerator.cs | Core OpenTelemetry image generator implementation |
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs | Updates to support image content serialization and fix metric recording |
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIImageGenerator.cs | Adds usage details extraction from OpenAI responses |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Image/ImageGenerationResponse.cs | Adds Usage property to track token usage |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Image/ImageGenerationOptions.cs | Adds AdditionalProperties for extensibility |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
fd800b0
to
5ca558c
Compare
Microsoft Reviewers: Open in CodeFlow