Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

Fixes #12961

Description

Aligns OpenAISettings.EnableSensitiveTelemetryData with AzureOpenAISettings by defaulting to TelemetryHelpers.EnableSensitiveDataDefault. This ensures consistent behavior across OpenAI integrations - the property now respects the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT environment variable (defaults to false if unset).

Changes:

  • Set EnableSensitiveTelemetryData default value to TelemetryHelpers.EnableSensitiveDataDefault
  • Updated XML documentation to document environment variable behavior
  • Linked AITelemetryHelpers.cs in Aspire.OpenAI.csproj to access TelemetryHelpers
  • Added tests verifying default behavior and configuration override

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.openai.com
    • Triggering command: /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.OpenAI.Tests/Debug/net10.0/Aspire.OpenAI.Tests --internal-msbuild-node /home/REDACTED/.local/share/37d0e97c58f3460bbe165c654539f648/.p --filter-not-trait category=failing --filter-not-trait quarantined=true --filter-not-trait outerloop=true (dns block)
    • Triggering command: /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.OpenAI.Tests/Debug/net8.0/Aspire.OpenAI.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.OpenAI.Tests/Debug/net8.0/Aspire.OpenAI.Tests.deps.json /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.OpenAI.Tests/Debug/net8.0/Microsoft.DotNet.RemoteExecutor.dll Aspire.OpenAI.Tests, Version=42.42.42.42, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 Aspire.OpenAI.Tests.ConformanceTests&#43;&lt;&gt;c &lt;TracingEnablesTheRightActivitySource_Keyed&gt;b__19_0 /tmp/d3zrawk2.bou (dns block)
    • Triggering command: /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.OpenAI.Tests/Debug/net10.0/Aspire.OpenAI.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.OpenAI.Tests/Debug/net10.0/Aspire.OpenAI.Tests.deps.json /home/REDACTED/work/aspire/aspire/artifacts/bin/Aspire.OpenAI.Tests/Debug/net10.0/Microsoft.DotNet.RemoteExecutor.dll Aspire.OpenAI.Tests, Version=42.42.42.42, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 Aspire.OpenAI.Tests.ConformanceTests&#43;&lt;&gt;c &lt;TracingEnablesTheRightActivitySource_Keyed&gt;b__19_0 /tmp/5ogzjyyl.a1n (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Default Aspire.OpenAI.OpenAISettings.EnableSensitiveTelemetryData to TelemetryHelpers.EnableSensitiveDataDefault.

See AzureOpenAISettings.EnableSensitiveTelemetryData as an example.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Set default for EnableSensitiveTelemetryData Default OpenAISettings.EnableSensitiveTelemetryData to TelemetryHelpers.EnableSensitiveDataDefault Nov 17, 2025
Copilot AI requested a review from JamesNK November 17, 2025 02:55
Copilot finished work on behalf of JamesNK November 17, 2025 02:55
@JamesNK JamesNK marked this pull request as ready for review November 17, 2025 02:57
Copilot AI review requested due to automatic review settings November 17, 2025 02:57
@github-actions
Copy link
Contributor

github-actions bot commented Nov 17, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12992

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12992"

Copy link
Contributor

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

This PR aligns OpenAISettings.EnableSensitiveTelemetryData with AzureOpenAISettings by defaulting to TelemetryHelpers.EnableSensitiveDataDefault, ensuring consistent behavior across OpenAI integrations. The property now respects the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT environment variable (defaults to false if unset).

Key changes:

  • Updated default value for EnableSensitiveTelemetryData to use TelemetryHelpers.EnableSensitiveDataDefault
  • Enhanced XML documentation to reflect environment variable behavior
  • Added comprehensive test coverage for default and configuration override scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Components/Aspire.OpenAI/OpenAISettings.cs Modified EnableSensitiveTelemetryData to default to TelemetryHelpers.EnableSensitiveDataDefault and updated XML documentation to describe environment variable behavior
src/Components/Aspire.OpenAI/Aspire.OpenAI.csproj Linked AITelemetryHelpers.cs from Common directory to provide access to TelemetryHelpers class
tests/Aspire.OpenAI.Tests/AspireOpenAIExtensionsTests.cs Added two test methods verifying default behavior based on environment variable and configuration override capability

@JamesNK JamesNK merged commit 3ba07ce into main Nov 17, 2025
591 of 597 checks passed
@JamesNK JamesNK deleted the copilot/default-enable-sensitive-telemetry branch November 17, 2025 23:30
@JamesNK
Copy link
Member

JamesNK commented Nov 17, 2025

/backport to release/13.0

@github-actions
Copy link
Contributor

Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/19448161972

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation missing for enabling OpenAI telemetry in .NET Aspire dashboard

3 participants