Conversation
|
🚀 Dogfood this PR with: curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11237Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11237" |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the Aspire OpenAI, Azure OpenAI, and Azure AI Inference components to use Microsoft.Extensions.AI (MEAI) for AI telemetry instead of the previous experimental OpenAI telemetry implementation. The change introduces a new EnableSensitiveTelemetryData configuration option and updates telemetry source names to work with both experimental and stable MEAI versions.
Key changes:
- Adds
EnableSensitiveTelemetryDataconfiguration option across all AI components - Updates telemetry source names from "OpenAI.*" to "Experimental.Microsoft.Extensions.AI" and "Microsoft.Extensions.AI"
- Removes experimental telemetry configuration logic and simplifies settings properties
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Components/Aspire.OpenAI/OpenAISettings.cs |
Removes experimental telemetry logic, adds EnableSensitiveTelemetryData property |
src/Components/Aspire.OpenAI/AspireOpenAIExtensions.cs |
Updates telemetry source names to MEAI sources |
src/Components/Aspire.OpenAI/AspireOpenAIClientBuilder.cs |
Adds EnableSensitiveTelemetryData parameter to constructor |
src/Components/Aspire.OpenAI/AspireOpenAIClientBuilderChatClientExtensions.cs |
Configures EnableSensitiveData on OpenTelemetryChatClient |
src/Components/Aspire.OpenAI/AspireOpenAIClientBuilderEmbeddingGeneratorExtensions.cs |
Configures EnableSensitiveData on OpenTelemetryEmbeddingGenerator |
src/Components/Aspire.Azure.AI.OpenAI/AzureOpenAISettings.cs |
Similar changes to OpenAI settings with MEAI telemetry |
src/Components/Aspire.Azure.AI.OpenAI/AspireAzureOpenAIExtensions.cs |
Updates to use MEAI telemetry sources |
src/Components/Aspire.Azure.AI.Inference/ChatCompletionsClientSettings.cs |
Adds EnableSensitiveTelemetryData and removes experimental logic |
src/Components/Aspire.Azure.AI.Inference/AspireAzureAIInferenceExtensions.cs |
Updates telemetry sources and configures sensitive data handling |
tests/Aspire.OpenAI.Tests/OpenAIPublicApiTests.cs |
Updates test constructor calls to include new parameter |
| Configuration schema files | Adds EnableSensitiveTelemetryData property definitions |
| string? deploymentName, | ||
| bool disableTracing) | ||
| bool disableTracing, | ||
| bool enableSensitiveTelemetryData) |
There was a problem hiding this comment.
Minor breaking change but I doubt folks are using this class directly. Probably not worth providing a constructor overload?
There was a problem hiding this comment.
We should add an overload and avoid breaking this.
There was a problem hiding this comment.
Oh wait, this is prerelease . Carry on
There was a problem hiding this comment.
Why do the builders use constructors? There will always be changes to types like these. For example, this PR. And literally every change to this type is going to be breaking.
Wouldn't init properties be better?
| { | ||
| builder.Services.AddOpenTelemetry() | ||
| .WithTracing(traceBuilder => traceBuilder.AddSource("OpenAI.*")); | ||
| .WithTracing(traceBuilder => traceBuilder.AddSource(telemetrySources)); |
There was a problem hiding this comment.
I'm confused at what layers of telemetry are the "right ones" to listen to.
Developers can use Aspire.OpenAI and not talk through Microsoft.Extensions.AI. They can grab the OpenAIClient from DI and use it directly. If they did that, they wouldn't get any telemetry right? Since we would only enable MEAI telemetry and MEAI isn't being invoked.
There was a problem hiding this comment.
Since we would only enable MEAI telemetry and MEAI isn't being invoked.
Correct. I think the solution is to clarify in the docs that telemetry is only available when OpenAI client is wrapped in Microsoft.Extensions.AI client.
I think the best approach is to standardize on MEAI as the provider of AI telemetry. The reality is that only MEAI is keeping up with GenAI semantic convention spec.
- Azure.AI.Interfence is two major changes behind the current spec: https://github.com/Azure/azure-sdk-for-net/blob/1af7c19fe8dcb7f7f843730117accbd6927ad2a4/sdk/ai/Azure.AI.Inference/src/Telemetry/OpenTelemetryScope.cs
- OpenAI is in an even worse state. It doesn't record input/output messages at all: https://github.com/openai/openai-dotnet/blob/dd6aa1303b0c7e9aaaedd3ce4208078ae8fe6cca/src/Utility/Telemetry/OpenTelemetryScope.cs
I don't want to enable both MEAI and OpenAI/Azure because then you'll see duplicate spans in tracing and duplicate counters in metrics.
The downside is there could be some implementation specific telemetry that is missed out on by only recording MEAI. That could be solved longer term by MEAI folks could reach out to implementations and agree on a way for them to add tags to the GenAI span, even if they didn't create it.
For example, Azure has azure.resource_provider.namespace that could be added to the active GenAI span. Azure could check to see if there is a current activity, and check if it is for GenAI (e.g. has gen_ai.system tag), and then add implementation specific metadata.
There was a problem hiding this comment.
Would it make sense if those libraries didn't have their own telemetry at all? The current state of the world is rather confusing.
There was a problem hiding this comment.
It's worth considering. Another issue is what happens if implementors have APIs that aren't exposed by MEAI. They might need their own telemetry then. Out of scope of this PR.
I think at least for Aspire integration we can take an opiniated stance that our GenAI telemetry settings are related to MEAI.
There was a problem hiding this comment.
Lets start there an open discussions with the right teams and people.
|
This is ready to review. It is a blocker for #11227 so should be looked at promptly. |
…n AspireOpenAIClientBuilder.
Description
Aspire chat integrations enable telemetry. Each integration enables telemetry in the respective implementation. This PR changes that to always use MEAI for telemetry.
The reason is implementations aren't keeping up with the GenAI semantic convention spec:
The reality is that only MEAI is keeping up with GenAI semantic convention spec.
I don't want to enable both MEAI and OpenAI/Azure because then you'll see duplicate spans in tracing and duplicate counters in metrics.
The downside is there could be some implementation specific telemetry that is missed out on by only recording MEAI. That could be solved longer term by MEAI folks could reach out to implementations and agree on a way for them to add tags to the GenAI span, even if they didn't create it.
For example, Azure has azure.resource_provider.namespace that could be added to the active GenAI span. Azure could check to see if there is a current activity, and check if it is for GenAI (e.g. has
gen_ai.systemtag), and then add implementation specific metadata.Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate