Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static DashboardTelemetryConfiguration Create(IConfiguration configuratio

return new()
{
ReportedTelemetryEnabled = !configuration.GetBool(DashboardTelemetryService.TelemetryOptOutConfigKey, defaultValue: false) &&
ReportedTelemetryEnabled = !configuration.GetBool(KnownConfigNames.DashboardTelemetryOptOut, defaultValue: false) &&
forwardedOptOut is not true
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public sealed class DashboardTelemetryService : AspireTelemetryBase
internal const string ReportedActivitySourceName = "Aspire.Dashboard.Reported";
internal const string DiagnosticsActivitySourceName = ReportedActivitySourceName + ".Diagnostics";
internal const string EventLogCategoryName = "Aspire.Dashboard.Reported.Events";
internal const string TelemetryOptOutConfigKey = "ASPIRE_DASHBOARD_TELEMETRY_OPTOUT";
private readonly DashboardTelemetryConfiguration _configuration;
private readonly IReadOnlyList<KeyValuePair<string, object?>> _defaultTags;

Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Hosting.Docker/Aspire.Hosting.Docker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Compile Include="..\Aspire.Hosting\Dcp\Process\ProcessOutputCapture.cs" Link="Shared\ProcessOutputCapture.cs" />
<Compile Include="..\Aspire.Hosting\Dcp\Process\ProcessUtil.cs" Link="Shared\ProcessUtil.cs" />
<Compile Include="$(SharedDir)DashboardImage.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)KnownConfigNames.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)PathLookupHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)ResourceNameComparer.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)KnownOtelConfigNames.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ internal static IResourceBuilder<DockerComposeAspireDashboardResource> CreateDas
// makes the published compose file non-reproducible.
return builder.CreateResourceBuilder(resource)
.WithImage(DashboardImage.Name, DashboardImage.ResolveTag())
.WithEnvironment(KnownConfigNames.DashboardTelemetryOptOut, "true")
.WithHttpEndpoint(targetPort: 18888)
// Expose the HTTP endpoint externally for the dashboard, it is password protected
// and disabled by default so an explicit call is required to turn it on.
Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Hosting.Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ builder.AddDockerComposeEnvironment("compose");
await builder.addDockerComposeEnvironment("compose");
```

The dashboard container included in the published Compose file opts out of dashboard usage and error telemetry by default (`ASPIRE_DASHBOARD_TELEMETRY_OPTOUT=true`). This does not affect the application's OpenTelemetry data sent to the dashboard.

### Volumes

Use an environment variable so projects and executables can use a local Aspire store directory while Docker Compose mounts the published named volume:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Compile Include="..\Aspire.Hosting\Dcp\Process\ProcessUtil.cs" LinkBase="Process" />
<Compile Include="$(SharedDir)ComputeEnvironmentEndpointResolver.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)DashboardImage.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)KnownConfigNames.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)KnownOtelConfigNames.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)PathLookupHelper.cs" LinkBase="Shared" />
<Compile Include="$(SharedDir)PublishingContextUtils.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ internal static IResourceBuilder<KubernetesAspireDashboardResource> CreateDashbo
// non-reproducible.
return builder.CreateResourceBuilder(resource)
.WithImage(DashboardImage.Name, DashboardImage.ResolveTag())
.WithEnvironment(KnownConfigNames.DashboardTelemetryOptOut, "true")
.WithHttpEndpoint(targetPort: 18888)
// Expose the HTTP endpoint so ingress or explicit host port mapping can route browser traffic to the dashboard.
.WithEndpoint("http", e => e.IsExternal = true)
Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Hosting.Kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ builder.AddKubernetesEnvironment("k8s");
await builder.addKubernetesEnvironment("k8s");
```

The dashboard container included in the published Helm chart opts out of dashboard usage and error telemetry by default (`ASPIRE_DASHBOARD_TELEMETRY_OPTOUT=true`). This does not affect the application's OpenTelemetry data sent to the dashboard.

### Volumes

Use a target-neutral volume when the Kubernetes environment's default storage policy is sufficient:
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting/Dashboard/DashboardOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void Configure(DashboardOptions options)

options.SuppressLoginUrlInStartupSummary = bool.TryParse(configuration["AppHost:SuppressDashboardLoginUrlInStartupSummary"], out var suppressLoginUrl) && suppressLoginUrl;

options.TelemetryOptOut = configuration.GetBool("ASPIRE_DASHBOARD_TELEMETRY_OPTOUT");
options.TelemetryOptOut = configuration.GetBool(KnownConfigNames.DashboardTelemetryOptOut);
}

private static string? NormalizeUrl(string? value)
Expand Down
1 change: 1 addition & 0 deletions src/Shared/KnownConfigNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal static class KnownConfigNames
public const string DashboardApiEnabled = "ASPIRE_DASHBOARD_API_ENABLED";
public const string DashboardApiDisabled = "ASPIRE_DASHBOARD_API_DISABLED";
public const string DashboardForwardedHeadersEnabled = "ASPIRE_DASHBOARD_FORWARDEDHEADERS_ENABLED";
public const string DashboardTelemetryOptOut = "ASPIRE_DASHBOARD_TELEMETRY_OPTOUT";

public const string ShowDashboardResources = "ASPIRE_SHOW_DASHBOARD_RESOURCES";
public const string ResourceServiceEndpointUrl = "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL";
Expand Down
15 changes: 15 additions & 0 deletions tests/Aspire.Cli.EndToEnd.Tests/DockerDeploymentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public async Task CreateAndDeployToDockerCompose()

// Step 10: Verify the frontend responds from inside its own network namespace.
await VerifyFrontendRespondsAsync(auto, counter);
await VerifyDashboardTelemetryOptOutAsync(auto, counter);

// Step 11: Clean up - destroy the deployment using aspire destroy
await auto.AspireDestroyAsync(counter);
Expand Down Expand Up @@ -204,11 +205,25 @@ public async Task CreateAndDeployToDockerComposeInteractive()

// Step 10: Verify the frontend responds from inside its own network namespace.
await VerifyFrontendRespondsAsync(auto, counter);
await VerifyDashboardTelemetryOptOutAsync(auto, counter);

// Step 11: Clean up - destroy the deployment using aspire destroy
await auto.AspireDestroyAsync(counter);
}

private static async Task VerifyDashboardTelemetryOptOutAsync(Hex1bTerminalAutomator auto, SequenceCounter counter)
{
// Select the deployed container without reloading Compose's parameterized configuration.
await auto.RunCommandAsync(
"dashboard=$(docker ps --filter 'label=com.docker.compose.service=compose-dashboard' " +
"--filter \"label=com.docker.compose.project.config_files=$PWD/deploy-output/docker-compose.yaml\" " +
"--format '{{.ID}}') && " +
"test -n \"$dashboard\" && " +
"docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' \"$dashboard\" | " +
"grep -Fx 'ASPIRE_DASHBOARD_TELEMETRY_OPTOUT=true'",
counter);
}

/// <summary>
/// Asserts the deployed frontend actually serves HTTP 200 from inside its own network namespace.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ await auto.VerifyDeploymentAsync(
testPath: "/test-deployment",
expectedResponse: response);

// The dashboard image has no printenv executable, so resolve the ready pod's ConfigMap-backed environment.
await auto.RunCommandAsync(
$"test \"$(kubectl get pods -n {k8sNamespace} -l app.kubernetes.io/component=env-dashboard " +
"-o jsonpath='{.items[*].spec.containers[?(@.name==\"env-dashboard\")].envFrom[*].configMapRef.name}')\" " +
"= 'env-dashboard-config' && " +
$"test \"$(kubectl get configmap env-dashboard-config -n {k8sNamespace} " +
"-o jsonpath='{.data.ASPIRE_DASHBOARD_TELEMETRY_OPTOUT}')\" = 'true'",
counter);

// =====================================================================
// Phase 5: Cleanup
// =====================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Reflection;
using Aspire.Dashboard.Configuration;
using Aspire.Dashboard.Model;
using Aspire.Dashboard.Telemetry;
using Aspire.Hosting;
using Aspire.DashboardService.Proto.V1;
using Google.Protobuf.WellKnownTypes;
Expand Down Expand Up @@ -74,7 +73,7 @@ internal static DashboardWebApplication CreateDashboardApp(

var config = new ConfigurationManager().AddInMemoryCollection(new Dictionary<string, string?>
{
[DashboardTelemetryService.TelemetryOptOutConfigKey] = "true"
[KnownConfigNames.DashboardTelemetryOptOut] = "true"
}).AddInMemoryCollection(configuration).Build();

// Add services to the container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Security.Cryptography.X509Certificates;
using Aspire.Dashboard.Configuration;
using Aspire.Dashboard.Telemetry;
using Aspire.Hosting;
using Grpc.Core;
using Grpc.Net.Client;
Expand Down Expand Up @@ -60,7 +59,7 @@ public static DashboardWebApplication CreateDashboardWebApplication(

var initialData = new Dictionary<string, string?>
{
[DashboardTelemetryService.TelemetryOptOutConfigKey] = "true",
[KnownConfigNames.DashboardTelemetryOptOut] = "true",
[DashboardConfigNames.DashboardFrontendUrlName.ConfigKey] = "http://127.0.0.1:0",
[DashboardConfigNames.DashboardOtlpGrpcUrlName.ConfigKey] = "http://127.0.0.1:0",
[DashboardConfigNames.DashboardOtlpHttpUrlName.ConfigKey] = "http://127.0.0.1:0",
Expand Down
4 changes: 2 additions & 2 deletions tests/Aspire.Dashboard.Tests/Integration/StartupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public async Task Configuration_LegacyDebugSession_DisablesTelemetryAndIgnoresTr
await using var app = IntegrationTestHelpers.CreateDashboardWebApplication(testOutputHelper,
additionalConfiguration: initialData =>
{
initialData[DashboardTelemetryService.TelemetryOptOutConfigKey] = "false";
initialData[KnownConfigNames.DashboardTelemetryOptOut] = "false";
initialData[DashboardConfigNames.Legacy.DebugSessionPortName.ConfigKey] = "not-a-port";
initialData[DashboardConfigNames.Legacy.DebugSessionServerCertificateName.ConfigKey] = "not base64";
initialData[DashboardConfigNames.Legacy.DebugSessionTokenName.ConfigKey] = "token!";
Expand Down Expand Up @@ -1140,7 +1140,7 @@ public async Task Startup_LauncherEnvironmentVariable_RecordsLaunchContext(strin
RemoveEnvironmentVariableSources(builder);
builder.Configuration.AddInMemoryCollection(new Dictionary<string, string?>
{
[DashboardTelemetryService.TelemetryOptOutConfigKey] = "true",
[KnownConfigNames.DashboardTelemetryOptOut] = "true",
[DashboardConfigNames.DashboardFrontendUrlName.ConfigKey] = "http://127.0.0.1:0",
[DashboardConfigNames.DashboardOtlpGrpcUrlName.ConfigKey] = "http://127.0.0.1:0",
[DashboardConfigNames.DashboardOtlpAuthModeName.ConfigKey] = nameof(OtlpAuthMode.Unsecured),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void Create_ResolvesDirectAndForwardedOptOut(string? directOptOut, bool?
{
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string, string?>
{
[DashboardTelemetryService.TelemetryOptOutConfigKey] = directOptOut,
[KnownConfigNames.DashboardTelemetryOptOut] = directOptOut,
[DashboardConfigNames.Legacy.DebugSessionTelemetryOptOutName.ConfigKey] = forwardedOptOut?.ToString()
}).Build();

Expand All @@ -43,7 +43,7 @@ public void Create_InvalidLegacyOptOut_Throws(string? directOptOut)
{
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string, string?>
{
[DashboardTelemetryService.TelemetryOptOutConfigKey] = directOptOut,
[KnownConfigNames.DashboardTelemetryOptOut] = directOptOut,
[DashboardConfigNames.Legacy.DebugSessionTelemetryOptOutName.ConfigKey] = "invalid"
}).Build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
image: "custom-dashboard:latest"
container_name: "custom-dashboard"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
CUSTOM_VAR: "custom-value"
ports:
- "8081:18888"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
env-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ASPIRE_DASHBOARD_FORWARDEDHEADERS_ENABLED: "true"
ports:
- "18888"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docker-compose-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
swarm-env-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
swarm-env-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
env1-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
env2-dashboard:
image: "mcr.microsoft.com/aspire/nightly/dashboard:13.6"
environment:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
ports:
- "18888"
expose:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public async Task PublishAsync_GeneratesValidHelmChart()
"templates/myapp/deployment.yaml",
"templates/myapp/service.yaml",
"templates/myapp/config.yaml",
"templates/myapp/secrets.yaml"
"templates/myapp/secrets.yaml",
"templates/env-dashboard/config.yaml"
};

SettingsTask settingsTask = default!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
api_image: "api:latest"
secrets: {}
config:
env_dashboard:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
api:
OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
api_image: "api:latest"
secrets: {}
config:
env_dashboard:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
api:
OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
api_image: "api:latest"
secrets: {}
config:
env_dashboard:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
api:
OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
parameters: {}
secrets: {}
config:
env_dashboard:
ASPIRE_DASHBOARD_TELEMETRY_OPTOUT: "true"
myapp:
DEFERRED_VALUE: ""
Loading
Loading