Skip to content

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Sep 15, 2025

Microsoft Reviewers: Open in CodeFlow

@stephentoub stephentoub requested a review from a team as a code owner September 15, 2025 01:05
@Copilot Copilot AI review requested due to automatic review settings September 15, 2025 01:05
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Sep 15, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants