Skip to content

Flag OTLP-configured resources that have sent no telemetry in describe and MCP list_resources - #22579

Open
Sébastien Ros (sebastienros) wants to merge 6 commits into
mainfrom
sebros/otlp-no-telemetry-hint
Open

Sébastien Ros (sebastienros) wants to merge 6 commits into
mainfrom
sebros/otlp-no-telemetry-hint

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

Description

JavaScript hosting methods (AddNodeApp, AddViteApp, AddJavaScriptApp, …) call WithOtlpExporter(), so the app gets OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, and the rest. A Node app without an OpenTelemetry SDK ignores them and exports nothing. Its trace list in aspire otel traces or the MCP server is then empty, and an agent reads that as "nothing happened" instead of "this resource can't send telemetry". In the benchmark behind #22509, none of 2,338 trials that listed traces saw the frontend.

This PR implements options 1 (CLI/MCP only) and 3 (docs) from the issue. Dashboard card and aspire-skills changes are out of scope.

User-facing behavior

  • aspire describe --format json (snapshot, not --follow) adds telemetryReceived to each resource whose AppHost configured OTLP export (OTEL_EXPORTER_OTLP_ENDPOINT set) when the dashboard telemetry API could be read. false means the dashboard has received no traces, logs, or metrics from it.

  • aspire describe (table) prints a note after the table that names the running resources with telemetryReceived: false:

    ℹ️  OpenTelemetry export is configured, but no telemetry has been received from: frontend
    The OTEL_* settings only take effect when the app registers an OpenTelemetry SDK. For Node.js apps, install @opentelemetry/auto-instrumentations-node and start the app with --require @opentelemetry/auto-instrumentations-node/register. An idle app may also have nothing to report yet.
    
  • MCP list_resources adds telemetry_received with the same meaning. When a resource on the page reports false, the response preamble adds one line that explains it. Otherwise the preamble is unchanged, so normal responses cost no extra tokens.

  • When OTLP isn't configured, or the dashboard API is unavailable, unreachable, or slower than 5 seconds, the field is omitted and the listing still succeeds.

  • The XML docs on AddNodeApp, AddBunApp, AddJavaScriptApp, AddViteApp, and AddNextJsApp, plus the Aspire.Hosting.JavaScript README, now say that the OTLP variables only take effect when the app has an SDK. They show the minimal Node.js registration:

    C#

    builder.AddViteApp("frontend", "../frontend")
           .WithEnvironment("NODE_OPTIONS", "--require @opentelemetry/auto-instrumentations-node/register");

    TypeScript

    await builder.addViteApp("frontend", "../frontend")
        .withEnvironment("NODE_OPTIONS", "--require @opentelemetry/auto-instrumentations-node/register");

Implementation

ResourceTelemetryStatus (CLI) checks each snapshot's environment for OTEL_EXPORTER_OTLP_ENDPOINT. It reads the dashboard's /api/telemetry/resources list through the existing TelemetryCommandHelpers and matches entries by composite name ({service.name}-{service.instance.id} equals the runtime resource name), the same mapping the dashboard uses. If an entry has no instance ID, it falls back to matching the display name. It makes no request when no resource has OTLP configured. docs/specs/cli-output-formats.md and docs/specs/cli-mcp.md document the new fields.

Validation

  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.DescribeCommandTests" --filter-class "*.ListResourcesToolTests" --filter-class "*.ExcludeFromMcpTests" --filter-class "*.AgentMcpCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true": passed (204/204). New tests cover the JSON field (including replica and no-instance-ID matching), the table note (running only), the MCP field and conditional preamble, and dashboard API failure in both paths.
  • dotnet build src/Aspire.Hosting.JavaScript/Aspire.Hosting.JavaScript.csproj: 0 warnings.

Part of epic #22511.

Fixes #22509

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

aspire describe (table and JSON snapshot) and the MCP list_resources tool
now report whether the dashboard has received telemetry from resources
whose AppHost configured OTLP export. A JavaScript app without an
OpenTelemetry SDK receives the OTEL_* variables but exports nothing; this
makes that state visible instead of looking like an idle resource. The
status degrades to absent when the dashboard telemetry API is unavailable.

Document on the JavaScript hosting APIs and README that the OTLP settings
need an SDK in the app, with the minimal Node.js registration.

Fixes #22509

Co-authored-by: Copilot App <[email protected]>
@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 -- 22579

Or

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

@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.

🟡 Changes recommended

Telemetry matching can falsely warn for persistent resources and custom identities, while resource-specific describe queries unnecessarily fetch unrelated telemetry and may incur a five-second delay.

2 open issues
1 file not reviewed
  • src/Aspire.Cli/Resources/DescribeCommandStrings.Designer.cs: Generated file
What changed in this PR

This PR helps users and agents distinguish missing telemetry from an absence of application activity, addressing the CLI, MCP, and documentation portions of #22509.

Changes:

  • Adds optional telemetry-received status to describe snapshots and MCP resource listings, with guidance when no telemetry has arrived.
  • Uses a bounded dashboard lookup that leaves resource listings available when telemetry status cannot be determined.
  • Documents JavaScript SDK registration and adds tests for status output and dashboard failures.
File Description
tests/​Aspire.Cli.Tests/​Mcp/​ListResourcesToolTests.cs Tests telemetry status, guidance, and lookup failures.
tests/​Aspire.Cli.Tests/​Mcp/​ExcludeFromMcpTests.cs Supplies the new HTTP client dependency.
tests/​Aspire.Cli.Tests/​Commands/​DescribeCommandTests.cs Tests JSON status, table hints, and lookup failures.
src/​Shared/​Model/​Serialization/​ResourceJson.cs Adds nullable telemetry status.
src/​Aspire.Hosting.JavaScript/​README.md Explains SDK requirements and Node.js registration.
src/​Aspire.Hosting.JavaScript/​JavaScriptHostingExtensions.cs Adds SDK guidance to hosting API documentation.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.zh-Hant.xlf Adds pending Traditional Chinese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.zh-Hans.xlf Adds pending Simplified Chinese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.tr.xlf Adds pending Turkish localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.ru.xlf Adds pending Russian localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.pt-BR.xlf Adds pending Brazilian Portuguese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.pl.xlf Adds pending Polish localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.ko.xlf Adds pending Korean localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.ja.xlf Adds pending Japanese localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.it.xlf Adds pending Italian localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.fr.xlf Adds pending French localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.es.xlf Adds pending Spanish localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.de.xlf Adds pending German localization entries.
src/​Aspire.Cli/​Resources/​xlf/​DescribeCommandStrings.cs.xlf Adds pending Czech localization entries.
src/​Aspire.Cli/​Resources/​DescribeCommandStrings.resx Defines missing-telemetry messages.
src/​Aspire.Cli/​Resources/​DescribeCommandStrings.Designer.cs Exposes the new resource strings.
src/​Aspire.Cli/​Mcp/​Tools/​ListResourcesTool.cs Adds telemetry status and conditional guidance.
src/​Aspire.Cli/​Commands/​DescribeCommand.cs Adds snapshot status and running-resource hints.
src/​Aspire.Cli/​Commands/​AgentMcpCommand.cs Passes the HTTP client factory to resource listing.
src/​Aspire.Cli/​Backchannel/​ResourceTelemetryStatus.cs Implements dashboard lookup and resource matching.
docs/​specs/​cli-output-formats.md Documents snapshot status and table hints.
docs/​specs/​cli-mcp.md Documents telemetry status and omission conditions.

Review effort: Balanced

@sebastienros
Sébastien Ros (sebastienros) marked this pull request as draft November 23, 2026 21:09
@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.

Use the resolved OTEL_SERVICE_NAME and service.instance.id from the
resource environment so persistent resources and apps with custom
identities are not reported as silent. Query the dashboard only for the
resources describe actually renders (the requested resource, and only
running ones for the table note), and collapse the lookup's error handling.

Co-authored-by: Copilot App <[email protected]>
@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.

🟡 Changes recommended

Mocked tests leave runtime identity mapping and authenticated dashboard lookup unverified, so end-to-end coverage is needed to catch missing or incorrect telemetryReceived values and resource-table notes.

1 open issue
2 resolved since last review
1 file not reviewed
  • src/Aspire.Cli/Resources/DescribeCommandStrings.Designer.cs: Generated file

Review effort: Balanced

Run a starter app with an SDK-less Node app and assert describe's
telemetryReceived values and table note through the real dashboard API.
Drop a one-caller factory from ResourceTelemetryStatus.

Co-authored-by: Copilot App <[email protected]>
@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

The null-token guard omits telemetry status and warnings from describe and MCP when anonymous dashboard access is enabled without an API key, despite the telemetry API being readable.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Telemetry status and warnings are omitted when the token is absent

src/​Aspire.Cli/​Backchannel/​ResourceTelemetryStatus.cs:113

With ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true and no configured API key, the dashboard exposes a readable telemetry API but returns a null token. This guard therefore omits telemetry status and warnings from both describe and MCP in that configuration. Allow requests without an authentication header when the token is absent; the existing exception handler can still handle genuine API failures.

1 file not reviewed
  • src/Aspire.Cli/Resources/DescribeCommandStrings.Designer.cs: Generated file

Review effort: Balanced

@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

Human assessment is needed because the telemetry guard omits available status and warnings for supported unsecured dashboards with null API tokens.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • src/Aspire.Cli/Resources/DescribeCommandStrings.Designer.cs: Generated file

Review effort: Balanced

The snapshot environment is DCP's effective environment: executables inherit
the AppHost process environment (for example the endpoint aspire run profiling
sets) and containers include ENV from their image. Count only spec entries so
resources the AppHost never configured for OTLP aren't flagged as silent, and
skip the per-resource assignment in describe JSON when the status is unknown.
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 23, 2026 23:27
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

17 / 101 PR test projects · 5 PR jobs, from 25 changed files.

Selected PR test projects (17 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Dashboard.Components.Tests, Aspire.Dashboard.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests, Aspire.Playground.Tests, Aspire.Templates.Tests, Infrastructure.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

⚠️ 9 of the 17 selected test projects come from a single change — src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs.

🔧 src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs (changed source)
→ 1 directly: Aspire.Hosting.JavaScript.Tests
→ 8 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests (2 hops), Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Dotnet.Tests (2 hops), Aspire.Hosting.Radius.Tests (2 hops), Aspire.Hosting.Tests, Aspire.Playground.Tests

🔧 src/Shared/Model/Serialization/ResourceJson.cs (changed source)
→ 4 via the project graph: Aspire.Dashboard.Components.Tests, Aspire.Dashboard.Tests, Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.Testing.Tests

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

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

🔧 src/Aspire.Cli/Resources/DescribeCommandStrings.resx (changed source)
→ 1 directly: Infrastructure.Tests

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

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

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

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

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Backchannel/ResourceTelemetryStatus.cs, src/Aspire.Cli/Commands/AgentMcpCommand.cs, src/Aspire.Cli/Commands/DescribeCommand.cs, src/Aspire.Cli/Mcp/Tools/ListResourcesTool.cs, src/Aspire.Cli/Resources/DescribeCommandStrings.Designer.cs, src/Aspire.Cli/Resources/DescribeCommandStrings.resx, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.cs.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.de.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.es.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.fr.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.it.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.ja.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.ko.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.pl.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.pt-BR.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.ru.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.tr.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.zh-Hans.xlf, src/Aspire.Cli/Resources/xlf/DescribeCommandStrings.zh-Hant.xlf, src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs
• affected project Aspire.Cli
native-dashboard-validation affected project Aspire.Dashboard
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 88395f5.

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.

🟢 Approval recommended

No active review issues remain for the CLI and MCP telemetry diagnostics change.

No open issues 🎉

1 file not reviewed
  • src/Aspire.Cli/Resources/DescribeCommandStrings.Designer.cs: Generated file

Review effort: Balanced

@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.

@sebastienros

Copy link
Copy Markdown
Contributor Author

PR Testing Report

PR information

  • PR: #22579, Flag OTLP-configured resources that have sent no telemetry in describe and MCP list_resources
  • Head: 88395f5b058ac5e1b45a735a16853c00ffeb89fe
  • Tested: 2026-11-24 UTC, Linux arm64 isolated container
  • Artifact: dogfood CLI 17.1.0-pr.22579.g88395f5b; version matches the PR head, rechecked after the run.

Changes analyzed

  • CLI describe JSON and table, MCP list_resources, dashboard telemetry lookup, and related localization and JSON model.
  • JavaScript hosting XML documentation and README; CLI/MCP output specifications.
  • CLI unit and end-to-end tests. No dashboard UI, extension, or CI infrastructure changes.

Executed scenarios

Real applications: JSON and table

Passed. Created a fresh aspire-starter with the PR template hive and non-interactive options. Added Aspire.Hosting.JavaScript, a Node app without an SDK (silent), a Node app using NODE_OPTIONS=--require @opentelemetry/auto-instrumentations-node/register (instrumented), and a plain executable without AppHost-configured OTLP (plain). Started the AppHost and waited for the resources.

aspire describe --format json reported telemetryReceived: false for silent, true for the instrumented Node app and starter API, and no telemetry status for plain. The table's no-telemetry note included silent and excluded instrumented and plain. A starter service sometimes appeared in the note before sending its first telemetry; this is consistent with the guidance that an idle or newly started app may not yet have exported anything.

MCP list_resources

Passed. Called aspire agent mcp over stdio with a real MCP initialize and tools/call request while the AppHost was running. list_resources returned telemetry_received: false for silent, true for instrumented, and no field for plain; the response included the SDK guidance.

Unavailable dashboard telemetry API

Passed. Paused the isolated dashboard process while keeping the AppHost running. aspire describe --format json and MCP list_resources both returned resources successfully with telemetry status omitted for silent and instrumented, rather than falsely reporting no telemetry or failing. Resumed the dashboard and stopped the AppHost.

Missing resource

Passed. aspire describe does-not-exist --apphost <apphost> --format json --non-interactive returned a nonzero exit code and Resource 'does-not-exist' not found.

Supporting evidence

  • Scenario commands and assertions: scenario.sh; captured output: scenario.log.
  • JSON status: describe.json; table: table.txt; MCP exchange: mcp.jsonl and mcp-response.txt.
  • Dashboard-unavailable output: describe-dashboard-stopped.json and mcp-dashboard-stopped.jsonl.
  • Negative case: missing.out and missing.err; startup and stop: start.log, stop.log.
  • Evidence files are in the isolated test workspace. Startup logs may contain a temporary dashboard login token and should not be published verbatim.
  • The PR-head CLI end-to-end job also passed. A prior targeted CLI test run passed 205 tests; these support, but do not replace, the dogfood scenarios above.
  • No screenshot was captured: this change does not modify dashboard UI.

Overall result

Passed. The PR artifact exhibited the expected positive, negative, and unavailable-dashboard behavior. The AppHost was stopped after testing.

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.

Copilot was unable to review this pull request due to rate limiting. Please try again later. See Usage limits for GitHub Copilot for details.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScript resources get OTLP settings but export nothing until the app adds an SDK, and nothing says so

3 participants