Fix MAUI OTLP dev tunnel endpoint resolution#18053
Open
jfversluis wants to merge 2 commits into
Open
Conversation
Resolve MAUI OTLP dev tunnel targets from the actual dashboard OTLP endpoint allocation when no static OTLP endpoint is configured. Preserve configured endpoint behavior and add regression coverage for dynamic, configured, and fail-fast scenarios. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18053Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18053" |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for MAUI OTLP dev tunnel stub endpoints to start with an unallocated (dynamic) port and later adopt the Aspire Dashboard’s allocated OTLP endpoint, plus new tests covering the dynamic/configured/error paths.
Changes:
- Update
OtlpLoopbackResourceto allowportto be nullable and to expose the createdEndpointAnnotation. - Enhance
WithOtlpDevTunnelinfrastructure to allocate the stub endpoint from dashboard endpoint-allocation events or from configured OTLP endpoint URLs. - Add tests validating stub allocation behavior and error handling when dashboard/endpoint allocation is missing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Maui.Tests/MauiPlatformExtensionsTests.cs | Adds tests for dynamic dashboard OTLP allocation, configured OTLP endpoint allocation, and failure modes. |
| src/Aspire.Hosting.Maui/Otlp/OtlpLoopbackResource.cs | Makes the OTLP stub endpoint optionally unallocated initially and exposes the endpoint annotation for later mutation. |
| src/Aspire.Hosting.Maui/MauiOtlpExtensions.cs | Implements event-driven stub allocation from dashboard endpoints and adds fast-fail errors when allocation can’t happen. |
| src/Aspire.Hosting.Maui/Aspire.Hosting.Maui.csproj | Links shared known endpoint/resource name constants needed by the new logic. |
Validate configured OTLP endpoint URLs with clear errors and make dynamic-path tests independent of ambient OTLP configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes MAUI OTLP dev tunnel endpoint resolution so mobile apps send telemetry to the actual Aspire dashboard OTLP endpoint when the dashboard uses dynamically allocated ports.
Previously,
WithOtlpDevTunnel()resolved the tunnel target from configuration and could fall back to the default OTLP port (18889) when no static dashboard OTLP endpoint URL was configured. File-based AppHosts commonly use dynamic dashboard OTLP ports, so the MAUI app could receive a dev tunnel endpoint that targeted a stale/non-listening port and telemetry would not appear in the dashboard.This change makes the MAUI OTLP dev tunnel:
ResourceEndpointsAllocatedEventwhen no explicit OTLP endpoint URL is configuredsrc/SharedUser-facing usage
The documented MAUI pattern continues to work without custom fixed-port workarounds:
When the dashboard allocates OTLP/gRPC dynamically, the generated MAUI environment now points to a dev tunnel for that allocated port instead of the stale fallback
18889.Validation:
Result: 76 passed.
Manual validation was also performed in
microsoft/aspire-sampleswith local packages: the MAUI iOS simulator used a dev tunnel for the dynamic dashboard OTLP/gRPC port and the dashboard showed logs, traces, and metrics formobile-ios-simulator.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?