Add profiling spans for aspire add#17347
Conversation
Instrument the add command with profiling spans for AppHost discovery, package search and selection, running instance cleanup, and package installation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17347Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17347" |
There was a problem hiding this comment.
Pull request overview
Adds profiling-only Activity spans to the Aspire CLI’s aspire add flow so --capture-profile exports clearly show where time is spent while discovering an AppHost, resolving channels/packages, stopping running instances, and installing the selected integration.
Changes:
- Introduced
aspire/cli/add*profiling span names and add-specific tags inProfilingTelemetry. - Instrumented
AddCommandto emit spans for AppHost discovery, configured channel lookup, package search/selection, stopping running instances, and package installation (with relevant tags). - Added a unit test validating the add-specific spans/tags are created and carry the profiling session context.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Cli/Telemetry/ProfilingTelemetry.cs | Adds add-command span names/tags and helper APIs to create/annotate add-specific profiling activities. |
| src/Aspire.Cli/Commands/AddCommand.cs | Wraps key aspire add stages in profiling spans and emits add-specific tags (selection, counts, language, install result). |
| tests/Aspire.Cli.Tests/Telemetry/ProfilingTelemetryTests.cs | Adds coverage ensuring add-specific spans are created with expected operation names, tags, and session propagation. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 0
mitchdenny
left a comment
There was a problem hiding this comment.
Reviewed the new aspire add profiling spans. Instrumentation is mostly clean and the unit tests cover each new scope and tag. Flagging three observability concerns — one moderate (1), two minor (2, 3).
Separate interactive package selection prompts from the select-package span, record package match kind, and mark the root add profiling span on graceful failure paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
❓ CLI E2E Tests unknown — 95 passed, 0 failed, 5 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26237621259 |
Documents the --capture-profile and --capture-profile-output options for aspire add, and the new profiling spans and tags introduced by microsoft/aspire#17347. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1037
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1037 targeting Updated Note This draft PR needs human review before merging. |
Description
Instruments
aspire addwith profiling spans so that--capture-profilecaptures where add time is spent — package search, package selection, and installation — alongside the existing run/ls profiling.What changed
New profiling spans in
ProfilingTelemetry:aspire/cli/add— root span for the whole add commandaspire/cli/add.find_apphost— AppHost project discoveryaspire/cli/add.get_configured_channel— NuGet channel lookup via msbuildaspire/cli/add.search_packages—dotnet package searchfor Aspire integrationsaspire/cli/add.select_package— records match count/kind and selected package (dispatch only, no user think time)aspire/cli/add.select_package.prompt— wraps interactive package/version prompts so user think time is filterableaspire/cli/add.stop_existing_instance— stopping any running AppHost before addaspire/cli/add.package—dotnet package addinstallationNew tags:
aspire.cli.add.integration.name,version_specified,source_specified,configured_channel,package.search_result_count,package.match_count,package.match_kind(exact/fuzzy/none),package.id,package.version,package.channel,package.successRoot
aspire/cli/addspan is marked with error status and exit code on all graceful failure paths (not just thrown exceptions).User-facing usage
Sample profile output (from
SimplePipelines.AppHostplayground):dotnet package searchanddotnet package addeach appear as childprocess dotnetspans so it's easy to see which subprocess dominates add time.Checklist