Skip to content

Conversation

eerhardt
Copy link
Member

Fix #7771

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.

PR Overview

This PR updates the OpenAI integration to pass an ILogger instance to the OpenTelemetry clients, ensuring that logging is correctly configured when telemetry is enabled. Key changes include:

  • Adding tests to verify logging behavior for keyed and non-keyed OpenAI clients.
  • Updating the production code to inject ILogger from the service provider in both embedding generator and chat client telemetry wrappers.

Reviewed Changes

File Description
tests/Aspire.OpenAI.Tests/AspireOpenAIClientBuilderChatClientExtensionsTests.cs Added tests to validate logging configuration for chat clients
tests/Aspire.OpenAI.Tests/AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs Added tests to validate logging configuration for embedding generators
src/Components/Aspire.OpenAI/AspireOpenAIClientBuilderEmbeddingGeneratorExtensions.cs Injected ILogger for creating telemetry-wrapped embedding generators
src/Components/Aspire.OpenAI/AspireOpenAIClientBuilderChatClientExtensions.cs Injected ILogger for creating telemetry-wrapped chat clients

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

@eerhardt eerhardt merged commit fe81722 into dotnet:main Feb 27, 2025
71 checks passed
@eerhardt eerhardt deleted the FixOpenAILogging branch February 27, 2025 20:04
@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update OpenAI OpenTelemetry integration to pass an ILogger
2 participants