aspire-monitoring
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAspire Monitoring
Aspire 监控
Aspire CLI provides full observability locally. For deployed apps, route to platform-specific tools.
Aspire CLI 提供完整的本地可观测能力。对于已部署的应用,请使用平台专属工具。
Diagnostics Bridge — Where To Look
诊断桥接——该查看哪里
| Need | Environment | Tool | Command / Route |
|---|---|---|---|
| Console logs | Local dev | Aspire CLI | |
| Structured logs | Local dev | Aspire CLI | |
| Distributed traces | Local dev | Aspire CLI | |
| Span detail | Local dev | Aspire CLI | |
| Resource state | Local dev | Aspire CLI | |
| Telemetry export | Local dev | Aspire CLI | |
| Standalone dashboard | Any (no AppHost) | Aspire CLI | |
| Browser console / network / screenshots | Local dev (frontend) | Aspire dashboard | Surfaced via |
| AppHost / deployment definition | Authoring | aspire-deployment skill | → |
| AKS workload (pod logs, pod state) | Deployed AKS | kubectl + Container Insights | |
| Azure resource health (App Insights, Front Door, NSP, private endpoint) | Deployed Azure | azure-diagnostics | → |
| App Service / Container Apps logs | Deployed Azure | azure-diagnostics | → |
| Logs/state | Deployed Docker / Compose | Docker CLI | |
Decision tree:
- Is this about AppHost code or deployment definition? → skill.
aspire-deployment - Is the app running locally via ? → Aspire CLI.
aspire start - Is it deployed to AKS? → kubectl + Container Insights for workload; for the cluster's Azure resources.
azure-diagnostics - Is it deployed to other Azure (App Service, Container Apps)? → .
azure-diagnostics - Is it deployed to Docker / Compose? → /
dockerCLI.docker compose
See diagnostics-bridge.md for detailed routing.
| 需求 | 环境 | 工具 | 命令/路由 |
|---|---|---|---|
| 控制台日志 | 本地开发 | Aspire CLI | |
| 结构化日志 | 本地开发 | Aspire CLI | |
| 分布式追踪 | 本地开发 | Aspire CLI | |
| Span 详情 | 本地开发 | Aspire CLI | |
| 资源状态 | 本地开发 | Aspire CLI | |
| 遥测导出 | 本地开发 | Aspire CLI | |
| 独立仪表板 | 任意环境(无需AppHost) | Aspire CLI | |
| 浏览器控制台/网络/截图 | 本地开发(前端) | Aspire仪表板 | 通过 |
| AppHost/部署定义 | 开发阶段 | aspire-deployment技能 | → |
| AKS工作负载(Pod日志、Pod状态) | 已部署至AKS | kubectl + Container Insights | |
| Azure资源健康状态(App Insights、Front Door、NSP、专用端点) | 已部署至Azure | azure-diagnostics | → |
| App Service/容器应用日志 | 已部署至Azure | azure-diagnostics | → |
| 日志/状态 | 已部署至Docker/Compose | Docker CLI | |
决策树:
- 是否涉及AppHost代码或部署定义? → 技能。
aspire-deployment - 应用是否通过在本地运行? → 使用Aspire CLI。
aspire start - 是否已部署至AKS? → 工作负载使用kubectl + Container Insights;集群Azure资源使用。
azure-diagnostics - 是否已部署至其他Azure服务(App Service、容器应用)? → 。
azure-diagnostics - 是否已部署至Docker/Compose? → /
dockerCLI。docker compose
查看diagnostics-bridge.md获取详细路由说明。
Investigation Workflow
排查流程
When something is wrong, investigate before editing code:
- — check resource state and endpoints
aspire describe - — structured logs first
aspire otel logs <resource> - — console output as secondary view
aspire logs <resource> - — cross-service activity
aspire otel traces <resource> - — zipped telemetry snapshot for deeper analysis
aspire export
出现问题时,请先排查再修改代码:
- —— 检查资源状态和端点
aspire describe - —— 优先查看结构化日志
aspire otel logs <resource> - —— 次要查看控制台输出
aspire logs <resource> - —— 跨服务活动追踪
aspire otel traces <resource> - —— 导出遥测快照包以进行深度分析
aspire export
Local Commands Reference
本地命令参考
| Command | Purpose | Example |
|---|---|---|
| Console stdout/stderr | |
| Stream logs in real-time | |
| Structured OpenTelemetry logs | |
| Distributed trace data | |
| Individual span detail | |
| Logs correlated to trace (⚠️ verify flag) | |
| Query a standalone dashboard (login URL or base URL + | |
| Query a standalone dashboard | |
| Resource state, endpoints, health | |
| Include proxies, helper containers, migrations | |
| Resource list with state (filtered) | |
| Resource list with hidden resources | |
| Portable telemetry bundle | |
| Standalone dashboard (foreground/blocking) | |
| 命令 | 用途 | 示例 |
|---|---|---|
| 控制台标准输出/错误输出 | |
| 实时流式输出日志 | |
| 结构化OpenTelemetry日志 | |
| 分布式追踪数据 | |
| 单个Span详情 | |
| 与指定追踪关联的日志(⚠️ 请验证参数) | |
| 查询独立仪表板(登录URL或基础URL + | |
| 查询独立仪表板 | |
| 资源状态、端点、健康状况 | |
| 包含代理、辅助容器、迁移任务 | |
| 带状态的资源列表(已过滤) | |
| 包含隐藏资源的列表 | |
| 可移植遥测包 | |
| 独立仪表板(前台/阻塞模式) | |
Hidden resources are filtered by default
默认隐藏资源会被过滤
aspire psaspire describe--include-hidden- Debugging proxies, sidecar/helper containers, or migration jobs.
- An expected resource is "missing" from /
aspire ps.aspire describe - Triaging connectivity or wiring issues that may involve infrastructure resources.
aspire psaspire describe--include-hidden- 调试代理、边车/辅助容器或迁移任务时。
- 预期资源未出现在/
aspire ps中时。aspire describe - 排查可能涉及基础设施资源的连接或配置问题时。
Tips for Agents
面向Agent的技巧
bash
undefinedbash
undefined✅ Use --format Json for machine parsing (supported: ps, describe, start)
✅ 使用--format Json以支持机器解析(支持命令:ps、describe、start)
aspire describe --format Json
aspire describe --format Json
✅ When a resource you expect is missing, retry with --include-hidden
✅ 若预期资源缺失,添加--include-hidden重试
aspire ps --include-hidden --format Json | jq '.[] | {name, displayName, state, hidden}'
aspire ps --include-hidden --format Json | jq '.[] | {name, displayName, state, hidden}'
✅ Get endpoints from describe, not guessing ports
✅ 从describe命令获取端点,而非猜测端口
ENDPOINT=$(aspire describe apiservice --format Json | jq -r '.endpoints[0].url')
ENDPOINT=$(aspire describe apiservice --format Json | jq -r '.endpoints[0].url')
✅ Use --apphost <path> when multiple AppHosts exist
✅ 存在多个AppHost时使用--apphost <路径>
aspire describe --apphost ./src/MyApp.AppHost/
undefinedaspire describe --apphost ./src/MyApp.AppHost/
undefinedKnown Diagnostics Issues
已知诊断问题
| Issue | Symptom | Workaround |
|---|---|---|
| TS AppHost DNS failure (#15782) | | Use |
| OTEL port not randomized in isolated mode | Avoid |
Resource missing from | Hidden-by-default resources such as proxies, helpers, or migrations | Re-run with |
Resolved in 13.3: The standalone-dashboard workaround for #16236 is obsolete — use(see below).aspire dashboard run
Standalone Dashboard (aspire dashboard run
)
aspire dashboard run独立仪表板(aspire dashboard run
)
aspire dashboard runaspire dashboard runbash
aspire dashboard runaspire dashboard runbash
aspire dashboard runDashboard: http://localhost:18888/login?t=<TOKEN>
仪表板地址: http://localhost:18888/login?t=<TOKEN>
OTLP/gRPC: http://localhost:4317
OTLP/gRPC: http://localhost:4317
OTLP/HTTP: http://localhost:4318
OTLP/HTTP: http://localhost:4318
> ⚠️ **Foreground / blocking.** `aspire dashboard run` does **not** return until you stop it (Ctrl-C). Agents must treat it as a long-running background process — start it with the bash tool's `mode="async"`, capture the dashboard URL and token from initial output, and leave it running. Do **not** invoke it as a one-shot synchronous command, and do **not** wait for it to "finish".
> ⚠️ **前台/阻塞模式**。`aspire dashboard run`会持续运行直到手动停止(Ctrl-C)。Agent需将其视为长期运行的后台进程——使用bash工具的`mode="async"`启动,从初始输出中捕获仪表板URL和令牌,并保持其运行。**请勿**将其作为单次同步命令调用,也**请勿**等待其"完成"。Connect the Aspire CLI to a standalone dashboard
将Aspire CLI连接至独立仪表板
aspire otel logsaspire otel traces--dashboard-urlaspire dashboard runbash
undefinedaspire otel logsaspire otel traces--dashboard-urlaspire dashboard runbash
undefinedStream structured logs from a standalone dashboard (login URL form)
从独立仪表板流式输出结构化日志(登录URL格式)
aspire otel logs --dashboard-url "http://localhost:18888/login?t=TOKEN" --follow
aspire otel logs --dashboard-url "http://localhost:18888/login?t=TOKEN" --follow
Search recent traces
搜索近期追踪数据
aspire otel traces --dashboard-url "http://localhost:18888/login?t=TOKEN"
For dashboards configured with API-key authentication (e.g., the standalone container image with a separate API key), pass `--api-key` alongside the base `--dashboard-url`:
```bash
aspire otel logs --dashboard-url https://my-dashboard.example.com --api-key "$DASHBOARD_API_KEY" --followThe container-image standalone dashboard still works for environments where the CLI isn't available.
aspire otel traces --dashboard-url "http://localhost:18888/login?t=TOKEN"
对于配置了API密钥认证的仪表板(例如独立容器镜像搭配单独的API密钥),请在`--dashboard-url`基础上添加`--api-key`参数:
```bash
aspire otel logs --dashboard-url https://my-dashboard.example.com --api-key "$DASHBOARD_API_KEY" --follow独立容器镜像仪表板仍适用于无法使用CLI的环境。
Browser Telemetry (Aspire.Hosting.Browsers
)
Aspire.Hosting.Browsers浏览器遥测(Aspire.Hosting.Browsers
)
Aspire.Hosting.BrowsersThe integration captures browser console logs, network requests, and screenshots from frontend resources during local development and surfaces them in the dashboard alongside server-side telemetry. Frontend resources opt in via .
Aspire.Hosting.BrowsersWithBrowserLogs()| Need | Action |
|---|---|
| Inspect browser telemetry that is already wired | Open the dashboard; browser logs / network / screenshots appear next to server telemetry for the resource |
| Confirm a frontend has it enabled | Check the AppHost for |
Add | → |
When parsing telemetry programmatically, browser logs surface as additional OTLP log records associated with the frontend resource — returns them alongside server logs.
aspire otel logs <frontend-resource>Aspire.Hosting.BrowsersWithBrowserLogs()| 需求 | 操作 |
|---|---|
| 查看已配置的浏览器遥测 | 打开仪表板;浏览器日志/网络/截图会与对应资源的服务器遥测一同展示 |
| 确认前端是否已启用该功能 | 检查AppHost中资源是否配置了 |
为资源添加 | → |
以编程方式解析遥测数据时,浏览器日志会作为关联前端资源的额外OTLP日志记录返回——会将其与服务器日志一同返回。
aspire otel logs <frontend-resource>Dashboard UX Features
仪表板UX功能
Agents inspecting a running dashboard should know:
- Notification center (bell icon, top-right) — surfaces results of resource commands and lifecycle events. Inline command responses appear here instead of being scraped from the logs panel.
- Rebuild command — available on container and project resources; rebuilds the image and restarts the resource without restarting the whole AppHost. Result lands in the notification center.
- Structured command results — custom resource commands return with a
ExecuteCommandResultpayload that the dashboard renders inline; HTTP commands setMessageto control how the response body is shown.HttpCommandResultMode.Auto | Json | Text | None
Authoring custom commands orcalls is AppHost work — route toWithBrowserLogs(). This skill is for observing what those features surface in the dashboard.aspireify
查看运行中仪表板的Agent需了解以下功能:
- 通知中心(右上角铃铛图标)——展示资源命令和生命周期事件的结果。命令的内联响应会显示在此处,而非从日志面板抓取。
- 重建命令——容器和项目资源可用;重新构建镜像并重启资源,无需重启整个AppHost。结果会显示在通知中心。
- 结构化命令结果——自定义资源命令返回,其中包含
ExecuteCommandResult负载,仪表板会内联渲染;HTTP命令可设置Message以控制响应体的展示方式。HttpCommandResultMode.Auto | Json | Text | None
自定义命令或调用的开发属于AppHost工作范畴——请路由至**WithBrowserLogs()**技能。本技能仅用于观测这些功能在仪表板中展示的内容。aspireify
Why Aspire CLI Can't Do Remote Diagnostics
为何Aspire CLI无法进行远程诊断
The Aspire CLI talks to a running AppHost through a local backchannel socket at . This is by design — there is no remote backchannel. For deployed apps, route to platform-specific tools (azure-diagnostics, kubectl, docker).
~/.aspire/backchannels/Exception: if a Dashboard is reachable (deployed alongside the app, or running standalone), and can query it via (login URL form) and optional (see the Standalone Dashboard section above). This does not apply to or .
aspire otel logsaspire otel traces--dashboard-url--api-keyaspire logsaspire describeAspire CLI通过本地回传套接字与运行中的AppHost通信。这是设计使然——不存在远程回传机制。对于已部署的应用,请使用平台专属工具(azure-diagnostics、kubectl、docker)。
~/.aspire/backchannels/例外情况:若仪表板可访问(与应用一同部署或独立运行),和可通过(登录URL格式)和可选的进行查询(详见上文独立仪表板部分)。此方式不适用于或命令。
aspire otel logsaspire otel traces--dashboard-url--api-keyaspire logsaspire describeHandoff Rules
转接规则
| Scenario | Route To |
|---|---|
| Start/stop/wait/rebuild lifecycle | → |
| Deploy, publish, pipeline steps, AppHost compute environment binding | → |
AppHost code changes ( | → |
| Deployed Azure resource health (App Insights, Front Door, NSP, private endpoint, ACA, App Service) | → |
| AKS workload diagnostics (pod logs, pod state, Container Insights) | → |
| Docker / Compose container logs | → |
| 场景 | 转接至 |
|---|---|
| 启动/停止/等待/重建生命周期 | → |
| 部署、发布、流水线步骤、AppHost计算环境绑定 | → |
AppHost代码修改( | → |
| 已部署Azure资源健康状态(App Insights、Front Door、NSP、专用端点、ACA、App Service) | → |
| AKS工作负载诊断(Pod日志、Pod状态、Container Insights) | → |
| Docker/Compose容器日志 | → |
Project-Local Skill Routing
项目本地技能路由
If exists (from ), see its
for deeper telemetry workflow guidance.
.agents/skills/aspire/SKILL.mdaspire agent initreferences/monitoring.md若存在(来自),请查看其获取更深入的遥测流程指导。
.agents/skills/aspire/SKILL.mdaspire agent initreferences/monitoring.mdReferences
参考资料
- diagnostics-bridge.md — Local vs deployed routing detail
- monitoring.md — Telemetry inspection and export patterns
- playwright-handoff.md — Find the correct Aspire frontend URL before browser testing
- diagnostics-bridge.md —— 本地与已部署环境的路由详情
- monitoring.md —— 遥测检查与导出模式
- playwright-handoff.md —— 浏览器测试前获取正确的Aspire前端URL