Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 26, 2025

Plan: Add configuration to suppress unsecured message in dashboard

This PR implements a configuration option to suppress the unsecured telemetry message displayed in the Aspire Dashboard when using OtlpAuthMode.Unsecured.

Changes needed:

  • Analyze current code structure and understand existing tests
  • Add SuppressUnsecuredTelemetryMessage property to OtlpOptions class
  • Add corresponding configuration name in DashboardConfigNames
  • Update MainLayout.razor.cs to check the new configuration option before showing the message
  • Add tests to verify the new configuration works correctly
  • Verify existing tests still pass
  • Manual testing to confirm the change works as expected
  • Address feedback: parameterize test and remove configuration tests

Changes implemented:

  1. Added new configuration property: Added SuppressUnsecuredTelemetryMessage boolean property to OtlpOptions class with XML documentation explaining its purpose
  2. Added configuration mapping: Added DashboardOtlpSuppressUnsecuredTelemetryMessageName to DashboardConfigNames with proper config key and environment variable mapping
  3. Updated UI logic: Modified MainLayout.OnInitializedAsync() to check both the auth mode and the new configuration option before showing the unsecured message
  4. Updated tests based on feedback:
    • Converted OnInitialize_UnsecuredOtlp_SuppressConfigured_NoMessageBar to a parameterized test using [Theory] and [InlineData]
    • The test now validates both suppressed (true) and not suppressed (false) scenarios
    • Removed the configuration validation tests from DashboardOptionsTests as requested
  5. Manual verification: Created and ran a test application to verify the configuration works correctly

Configuration usage:

  • Config Key: Dashboard:Otlp:SuppressUnsecuredTelemetryMessage
  • Environment Variable: DASHBOARD__OTLP__SUPPRESSUNSECUREDTELEMETRYMESSAGE
  • Default Value: false (preserves existing behavior)

Test results:

  • ✅ All MainLayout tests pass (4 tests including parameterized suppression test)
  • ✅ All DashboardOptions tests pass (19 tests after removing configuration tests)
  • ✅ Full build completes successfully
  • ✅ Manual test application confirms configuration works correctly

The implementation is minimal and surgical, adding only the necessary functionality without breaking existing behavior. When the configuration is set to true, the unsecured telemetry message will not be shown regardless of the user's dismiss state, while maintaining backward compatibility by defaulting to false.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add configuration to suppress unsecured message in dashboard</issue_title>
<issue_description>Add configuration to suppress unsecured message in dashboard to OtlpOptions. This message is displayed in MainLayout.razor.cs when auth mode is OtlpAuthMode.Unsecured.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #11672

💡 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.

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Copilot AI changed the title [WIP] Add configuration to suppress unsecured message in dashboard Add configuration to suppress unsecured telemetry message in dashboard Sep 26, 2025
Copilot AI requested a review from JamesNK September 26, 2025 06:48
Copilot finished work on behalf of JamesNK September 26, 2025 06:48
…tions tests

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Copilot AI requested a review from JamesNK September 26, 2025 07:01
Copilot finished work on behalf of JamesNK September 26, 2025 07:01
@JamesNK JamesNK marked this pull request as ready for review September 26, 2025 07:07
Copilot AI review requested due to automatic review settings September 26, 2025 07:07
@github-actions
Copy link
Contributor

github-actions bot commented Sep 26, 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 -- 11673

Or

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

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 adds a configuration option to suppress the unsecured telemetry message in the Aspire Dashboard when using OtlpAuthMode.Unsecured. The implementation provides administrators with the ability to hide the warning message about unsecured OTLP endpoints.

  • Adds SuppressUnsecuredTelemetryMessage boolean property to OtlpOptions with proper configuration mapping
  • Updates the MainLayout logic to check both the auth mode and the new configuration option
  • Enhances existing tests with a parameterized test to validate both suppressed and non-suppressed scenarios

Reviewed Changes

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

File Description
src/Aspire.Dashboard/Configuration/DashboardOptions.cs Adds new SuppressUnsecuredTelemetryMessage property to OtlpOptions class
src/Shared/DashboardConfigNames.cs Adds configuration name mapping for the new suppress option
src/Aspire.Dashboard/Components/Layout/MainLayout.razor.cs Updates UI logic to check configuration before showing unsecured message
tests/Aspire.Dashboard.Components.Tests/Layout/MainLayoutTests.cs Adds parameterized test and updates test helper method to support new configuration

@JamesNK JamesNK merged commit d9077f9 into main Sep 27, 2025
311 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 9.6 milestone Sep 27, 2025
@davidfowl
Copy link
Member

@ShilpiRach do you want us to backport this to 9.5.1 so it can be used by app service?

@eerhardt
Copy link
Member

/backport to release/9.5

@github-actions
Copy link
Contributor

Started backporting to release/9.5: https://github.com/dotnet/aspire/actions/runs/18415472246

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add configuration to suppress unsecured message in dashboard

4 participants