You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Record an aspire/dashboard/startup product telemetry event so dashboard startup reliability and performance can be measured across launch contexts.
The event records the startup result, elapsed duration in milliseconds, and launch context. Failed startup attempts also include error.type: invalid_config for options validation failures, address_in_use for address conflicts, canceled for token-driven startup cancellation, or the exception type for other failures. The first result is recorded once; later shutdown or error handling does not replace it.
Launch context is read from the bound DashboardOptions.LaunchContext value. Configure it with Dashboard:LaunchContext or DASHBOARD__LAUNCHCONTEXT, which uses standard environment-variable binding. AppHost and CLI launchers set apphost and cli, respectively. Container deployments can explicitly set container; the dashboard does not infer container execution. Values are trimmed and matched case-insensitively against the known contexts, with missing or unrecognized values reported as unknown.
The startup timestamp is captured at the start of dashboard construction, before configuration and options validation. Telemetry uses the bound options snapshot rather than resolving validated options through DI, allowing configuration validation failures to retain their launch context. Dashboard execution starts the host separately from waiting for shutdown, so startup failures are recorded before the service provider is disposed. Existing product telemetry opt-out behavior is unchanged.
Configuration example
Container deployments can supply:
DASHBOARD__LAUNCHCONTEXT=container
The equivalent JSON configuration is:
{
"Dashboard": {
"LaunchContext": "container"
}
}
Validation
Commands were run locally on Windows with MSBUILDTERMINALLOGGER=false for test runs. Quarantined and outerloop tests were excluded.
.\restore.cmd — passed.
Full dashboard suite — 2,199 passed, no failures:
dotnet test --project tests\Aspire.Dashboard.Tests\Aspire.Dashboard.Tests.csproj --no-launch-profile /p:InstallBrowsersForPlaywright=false ----filter-not-trait 'quarantined=true'--filter-not-trait 'outerloop=true'
AppHost dashboard environment tests — 7 passed:
dotnet test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile ----filter-method '*.ConfigureEnvironmentVariables_ConfiguresDashboardApplicationNameAndPersistenceMode'--filter-not-trait 'quarantined=true'--filter-not-trait 'outerloop=true'
CLI dashboard environment test — 1 passed:
dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile ----filter-method '*.DashboardRunCommand_ConfiguresDashboardDebugLogging'--filter-not-trait 'quarantined=true'--filter-not-trait 'outerloop=true'
The integration regression test uses the launchers' shared environment-variable key, the real environment configuration provider, options binding, and the emitted startup event for both apphost and cli. Temporarily restoring the old environment-variable name reproduced the issue: both cases failed with unknown; restoring the fix made them pass. The tests also cover launch context on configuration validation failure.
Dashboard component suite — incomplete, not passed. The initial run stalled and was stopped. A bounded retry recorded 723 passed tests, no individual test failures, but timed out after five minutes with exit code 7:
This marks startup successful before the rest of this callback and all other ApplicationStarted callbacks have completed. If a later callback throws, _app.StartAsync fails and RecordStartupFailure becomes a no-op because this telemetry object is one-shot, so the event reports success even though Run returns an error. Record success only after the awaited _app.StartAsync call completes.
Read ASPIRE_DASHBOARD_LAUNCH_CONTEXT from the environment key
AppHost and CLI set ASPIRE_DASHBOARD_LAUNCH_CONTEXT, but this reads only Dashboard:LaunchContext. The environment provider only maps double underscores to configuration separators, so the single-underscore variable remains under its literal key and both launch paths emit unknown. Read EnvVarName first (with ConfigKey as a fallback), and update the normalization test to exercise the environment-variable key.
Read startup launch context from bound dashboard options and use DASHBOARD__LAUNCHCONTEXT in launchers. Cover launcher environment binding and configuration-validation failures with regression tests.
Co-authored-by: Copilot <[email protected]>
Construction failures are still omitted from the startup event even though the telemetry contract says other startup failures report their exception type. For example, AddKeyPerFile can throw for a missing configured directory (already covered by Configuration_FileConfigDirectoryDoesntExist_Error), and this occurs before telemetry services are registered; Program also constructs DashboardWebApplication outside its try, so no failure event is emitted. Either add a bootstrap path that records constructor/configuration failures while honoring opt-out, or narrow the documented reliability contract to the failures that can actually be observed.
This issue also appears on line 473 of the same file.
Document the aspire/dashboard/startup product telemetry event added in
microsoft/aspire#20846: startup result, duration, launch context, and
failure error type. Add the Dashboard:LaunchContext configuration
option to the dashboard configuration reference.
Co-authored-by: Copilot <[email protected]>
Documented the new aspire/dashboard/startup telemetry event and Dashboard:LaunchContext option, triggered by signals cli_command_file_changed (evidence: DashboardRunCommand.cs sets DashboardConfigNames.DashboardLaunchContextName.EnvVarName to cli) and pr_body_has_cli_flag_mention. Updated dashboard/microsoft-collected-dashboard-telemetry.mdx with a new "Startup telemetry" section (result, duration, launch context, error types, opt-out) and dashboard/configuration.mdx with a Dashboard:LaunchContext row in the Other options table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Record an
aspire/dashboard/startupproduct telemetry event so dashboard startup reliability and performance can be measured across launch contexts.The event records the startup result, elapsed duration in milliseconds, and launch context. Failed startup attempts also include
error.type:invalid_configfor options validation failures,address_in_usefor address conflicts,canceledfor token-driven startup cancellation, or the exception type for other failures. The first result is recorded once; later shutdown or error handling does not replace it.Launch context is read from the bound
DashboardOptions.LaunchContextvalue. Configure it withDashboard:LaunchContextorDASHBOARD__LAUNCHCONTEXT, which uses standard environment-variable binding. AppHost and CLI launchers setapphostandcli, respectively. Container deployments can explicitly setcontainer; the dashboard does not infer container execution. Values are trimmed and matched case-insensitively against the known contexts, with missing or unrecognized values reported asunknown.The startup timestamp is captured at the start of dashboard construction, before configuration and options validation. Telemetry uses the bound options snapshot rather than resolving validated options through DI, allowing configuration validation failures to retain their launch context. Dashboard execution starts the host separately from waiting for shutdown, so startup failures are recorded before the service provider is disposed. Existing product telemetry opt-out behavior is unchanged.
Configuration example
Container deployments can supply:
The equivalent JSON configuration is:
{ "Dashboard": { "LaunchContext": "container" } }Validation
Commands were run locally on Windows with
MSBUILDTERMINALLOGGER=falsefor test runs. Quarantined and outerloop tests were excluded..\restore.cmd— passed.apphostandcli. Temporarily restoring the old environment-variable name reproduced the issue: both cases failed withunknown; restoring the fix made them pass. The tests also cover launch context on configuration validation failure.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?