Skip to content

Include exception details in dashboard product telemetry - #22705

Merged
James Newton-King (JamesNK) merged 3 commits into
mainfrom
jamesnk/dashboard-error-telemetry
Nov 26, 2026
Merged

James Newton-King (JamesNK) merged 3 commits into
mainfrom
jamesnk/dashboard-error-telemetry

Conversation

@JamesNK

@JamesNK James Newton-King (JamesNK) commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Description

The Dashboard's direct Azure Monitor exporter (#20730) reports the exception type but not what went wrong or where. This PR adds the standard OpenTelemetry attributes exception.message and exception.stacktrace to aspire/dashboard/error, so reviewers can distinguish failures with the same exception type.

  • The Dashboard and CLI share error-tag creation. The CLI's existing exception reporting is unchanged.
  • Dashboard string attributes are capped at 2,048 UTF-16 code units, below Azure Monitor's 8,192-character custom-property ceiling. This keeps payloads small; truncated messages and stack traces end with an ellipsis without splitting surrogate pairs.
  • The Dashboard previously included process.runtime.version on errors. This PR stops sending it and leaves the shared default tag commented out. In Native AOT builds it identifies the bundled runtime, not the user's installed .NET or the runtime running their AppHost. Aspire version and build ID are already reported.

No new dependencies or UI changes.

Where the fields appear

In Application Insights, filter AppTraces to Message == "aspire/dashboard/error" and inspect Properties["exception.type"], Properties["exception.message"], and Properties["exception.stacktrace"]. The stack trace is empty if unavailable. The event remains a structured log, and ASPIRE_DASHBOARD_TELEMETRY_OPTOUT=true still disables Dashboard product export.

Security considerations

The Dashboard sent messages and stacks to the legacy IDE bridge, but the Aspire VS Code extension stripped both fields before forwarding. Sending them directly to Azure Monitor therefore expands collection. Messages and stacks can include secrets, resource names, or workspace paths. Truncation limits payload size; it does not redact sensitive values. Privacy/security review is still needed before shipping. Live Azure ingestion was not tested.

Validation

Current PR head: 16 focused Dashboard tests and 8 CLI export tests passed. These cover exception attributes, truncation, and the absence of the runtime tag.

Exact commands and earlier suite results

Focused tests after disabling the runtime tag:

Command Result
.\.dotnet\dotnet.exe test --project .\tests\Aspire.Dashboard.Tests\Aspire.Dashboard.Tests.csproj --no-restore --no-launch-profile -- --filter-class '*.DashboardTelemetryMetadataTests' --filter-class '*.TelemetryErrorRecorderTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' 16 passed
.\.dotnet\dotnet.exe test --project .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-restore --no-launch-profile -- --filter-class '*.ReportedLogExportTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' 8 passed

Broader runs before disabling the runtime tag:

Command Result
.\.dotnet\dotnet.exe test --project .\tests\Aspire.Dashboard.Tests\Aspire.Dashboard.Tests.csproj --no-restore --no-launch-profile -- --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' 2,801 passed
.\.dotnet\dotnet.exe test --project .\tests\Aspire.Dashboard.Components.Tests\Aspire.Dashboard.Components.Tests.csproj --no-restore --no-launch-profile -- --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' 1,594 passed
.\.dotnet\dotnet.exe test --project .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-restore --no-launch-profile -- --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' 10,477 passed, 2 failed, 133 skipped

The two CLI failures reproduced in a focused rerun. Both concern NuGet source selection: AllWritersMaterializeTheComposedSourceRestriction and PrepareAsync_WithProjectReferencesAndExplicitChannel_UsesDiscoveredConfigAndPersistentPolicyOverlay. They were not verified on a clean baseline.

Fixes # (issue)

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

@github-actions

Copy link
Copy Markdown
Contributor

🚀 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22705

Or

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

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Exporting raw Dashboard exception messages and stacks through default-enabled product telemetry requires the pending human privacy/security review of consent and sensitive-data handling.

No open issues 🎉

What changed in this PR

This follow-up to #20730 adds exception messages and stack traces to Dashboard product telemetry, helping distinguish failures with the same exception type. It retains the existing opt-out and structured-log format.

Changes:

  • Share exception-tag creation and add runtime-version metadata across Dashboard and CLI product telemetry.
  • Bound Dashboard strings to 2,048 UTF-16 code units using surrogate-safe truncation.
  • Update tests and documentation for the expanded payload and its privacy implications.
File Description
tests/​Aspire.Dashboard.Tests/​Telemetry/​TelemetryErrorRecorderTests.cs Verify exception details and truncation.
tests/​Aspire.Dashboard.Tests/​Telemetry/​TagEnrichmentProcessorTests.cs Expect runtime-version metadata on activities.
tests/​Aspire.Dashboard.Tests/​Telemetry/​DashboardTelemetryServiceTests.cs Update error payload and string-boundary assertions.
tests/​Aspire.Dashboard.Tests/​Telemetry/​DashboardTelemetryMetadataTests.cs Verify runtime-version defaults.
tests/​Aspire.Cli.Tests/​Telemetry/​ReportedLogExportTests.cs Check runtime version in exported logs.
src/​Shared/​Telemetry/​TelemetryMetadata.cs Add runtime version to common metadata.
src/​Shared/​Telemetry/​AspireTelemetryBase.cs Centralize exception tags and their creation.
src/​Shared/​AssemblyVersionHelper.cs Provide cached runtime-version extraction.
src/​Aspire.Dashboard/​Utils/​VersionHelpers.cs Delegate runtime-version lookup to the shared helper.
src/​Aspire.Dashboard/​Telemetry/​TelemetryPropertyKeys.cs Reuse shared telemetry tag constants.
src/​Aspire.Dashboard/​Telemetry/​DashboardTelemetryService.cs Admit exception details and apply updated string limits.
src/​Aspire.Cli/​Telemetry/​TelemetryConstants.cs Reuse shared exception-tag constants.
docs/​specs/​aspire-product-telemetry.md Document metadata, limits, and sensitive exception content.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The updated test expects process.runtime.version, but its fixture’s default-tag producer omits that tag, causing the assertion to fail with nine actual keys instead of ten expected keys.

1 open issue

Review effort: Balanced

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

55 / 101 PR test projects · 5 PR jobs, from 11 changed files.

Selected PR test projects (55 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Dashboard.Components.Tests, Aspire.Dashboard.Tests, Aspire.Hosting.Analyzers.Tests, Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Kusto.Tests, Aspire.Hosting.Azure.Provisioning.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Browsers.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests, Aspire.Hosting.DevTunnels.Tests, Aspire.Hosting.Docker.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.EntityFrameworkCore.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Garnet.Tests, Aspire.Hosting.Go.Tests, Aspire.Hosting.Java.Tests, Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Kafka.Tests, Aspire.Hosting.Keycloak.Tests, Aspire.Hosting.Kubernetes.Tests, Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests, Aspire.Hosting.MongoDB.Tests, Aspire.Hosting.MySql.Tests, Aspire.Hosting.Nats.Tests, Aspire.Hosting.OpenAI.Tests, Aspire.Hosting.Oracle.Tests, Aspire.Hosting.Orleans.Tests, Aspire.Hosting.PostgreSQL.Tests, Aspire.Hosting.Python.Tests, Aspire.Hosting.Qdrant.Tests, Aspire.Hosting.RabbitMQ.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Redis.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests, Aspire.Hosting.Seq.Tests, Aspire.Hosting.SqlServer.Tests, Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests, Aspire.Hosting.Valkey.Tests, Aspire.Hosting.Yarp.Tests, Aspire.Playground.Tests, Aspire.Templates.Tests

Selected PR jobs (5)

cli-starter-validation, extension-e2e, native-dashboard-validation, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 43 of the 55 selected test projects come from a single change — src/Shared/AssemblyVersionHelper.cs.

🔧 src/Shared/AssemblyVersionHelper.cs (changed source)
→ 43 via the project graph

show 43

Aspire.Hosting.Analyzers.Tests (2 hops), Aspire.Hosting.Azure.EntraId.Tests (2 hops), Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Azure.Provisioning.Tests (3 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Browsers.Tests (2 hops), Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests (2 hops), Aspire.Hosting.DevTunnels.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.EntityFrameworkCore.Tests (2 hops), Aspire.Hosting.Foundry.Tests (2 hops), Aspire.Hosting.Garnet.Tests (2 hops), Aspire.Hosting.Go.Tests (2 hops), Aspire.Hosting.Java.Tests (2 hops), Aspire.Hosting.Kafka.Tests (2 hops), Aspire.Hosting.Keycloak.Tests (2 hops), Aspire.Hosting.Kubernetes.Tests (2 hops), Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests (2 hops), Aspire.Hosting.MongoDB.Tests (2 hops), Aspire.Hosting.MySql.Tests (2 hops), Aspire.Hosting.Nats.Tests (2 hops), Aspire.Hosting.OpenAI.Tests (2 hops), Aspire.Hosting.Oracle.Tests (2 hops), Aspire.Hosting.Orleans.Tests (2 hops), Aspire.Hosting.PostgreSQL.Tests (2 hops), Aspire.Hosting.Python.Tests (2 hops), Aspire.Hosting.Qdrant.Tests (2 hops), Aspire.Hosting.RabbitMQ.Tests (2 hops), Aspire.Hosting.Redis.Tests (2 hops), Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests (2 hops), Aspire.Hosting.Seq.Tests (2 hops), Aspire.Hosting.SqlServer.Tests (2 hops), Aspire.Hosting.Valkey.Tests (2 hops), Aspire.Hosting.Yarp.Tests (2 hops), Aspire.Playground.Tests

🔧 src/Aspire.Dashboard/Telemetry/DashboardTelemetryService.cs (changed source)
→ 8 via the project graph: Aspire.Dashboard.Components.Tests, Aspire.Hosting.Blazor.Tests (2 hops), Aspire.Hosting.Dotnet.Tests (2 hops), Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Radius.Tests (2 hops), Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests

📦 affected project Aspire.Hosting.Dotnet
→ 2 tests: Aspire.Cli.EndToEnd.Tests, Aspire.Templates.Tests

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

📦 affected project Aspire.Dashboard
→ 1 test: Aspire.Templates.Tests

🧪 tests/Aspire.Cli.Tests/Telemetry/ReportedLogExportTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Dashboard.Tests/Telemetry/DashboardTelemetryMetadataTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Tests

🧪 tests/Aspire.Dashboard.Tests/Telemetry/DashboardTelemetryServiceTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Tests

🧪 tests/Aspire.Dashboard.Tests/Telemetry/TelemetryErrorRecorderTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Telemetry/TelemetryConstants.cs, src/Aspire.Dashboard/Telemetry/DashboardTelemetryService.cs, src/Aspire.Dashboard/Telemetry/TelemetryPropertyKeys.cs, src/Aspire.Dashboard/Utils/VersionHelpers.cs
• affected project Aspire.Cli
native-dashboard-validation affected project Aspire.Dashboard
polyglot • affected project Aspire.Cli
• affected project Aspire.Hosting.Azure.Provisioning
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 8c86b58.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Deployment E2E evidence is still missing to confirm that a deployed Dashboard error is exported with both exception.message and exception.stacktrace.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Document the completed deployment E2E result

src/​Aspire.Dashboard/​Telemetry/​DashboardTelemetryService.cs:176

Please add the completed deployment E2E run and its result for a deployed Dashboard error being exported with exception.message and exception.stacktrace. The validation listed in the PR description contains unit/component results but no completed deployment E2E result.

1 resolved since last review

Review effort: Balanced

@JamesNK
James Newton-King (JamesNK) merged commit 00417fc into main Nov 26, 2026
369 checks passed
@JamesNK

Copy link
Copy Markdown
Member Author

/backport to release/17.0

@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.1 milestone Nov 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/17.0 (link to workflow run)

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #2258

Generated by PR Documentation Check · copilot · auto (Claude Sonnet 5.5) · ~27 AIC · ⌖ ~11 AIC · ⊞ 7.6K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#2258 targeting release/17.1.

Updated dashboard/microsoft-collected-dashboard-telemetry.mdx to document exception.message/exception.stacktrace on aspire/dashboard/error (2,048-char truncation) and removal of process.runtime.version. Signals: defaults_or_constants_file_changed (TelemetryConstants.cs), pr_body_has_cli_flag_mention (PR body).

Note

This draft PR needs human review before merging.

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.

3 participants