Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 11, 2025

Overview

Extends the uninstrumented peer visualization mechanism in Aspire 9.3 to support parameters, connection strings, and GitHub models resources. Previously, outgoing calls from these resource types to uninstrumented peers did not appear as referenced peers in the trace timeline.

Implementation

Extended ResourceOutgoingPeerResolver.TryResolvePeerNameCore to support peer resolution beyond just URL properties:

1. Connection String Support

  • Parses resource.connectionString property for Endpoint= patterns
  • Supports GitHub Models connection strings:
    Endpoint=https://models.github.ai/inference;Key=...;Model=openai/gpt-4o-mini
    Endpoint=https://models.github.ai/orgs/myorg/inference;Key=...;Model=openai/gpt-4o-mini
    
  • Extracts models.github.ai:443 for peer matching

2. Parameter Value Support

  • Extracts host:port from Value property of Parameter resources
  • Example: https://api.example.com:8080/endpointapi.example.com:8080

3. Consistent Address Matching

  • Applies same transformations as existing URL matching (comma-to-colon, localhost-to-127.0.0.1)
  • Maintains full compatibility with existing peer resolution behavior

Key Functions Added

  • TryExtractEndpointFromConnectionString: Parses connection strings for Endpoint= patterns and extracts host:port
  • TryParseUrlHostAndPort: Extracts host:port from URLs in parameter values
  • DoesAddressMatch: Applies address transformations for consistent matching with existing logic

Testing

Added comprehensive unit tests covering:

  • GitHub Models connection strings (with and without organization)
  • Parameter resources with URL values
  • Connection strings without endpoints (negative cases)
  • Parameter resources with non-URL values (negative cases)

Impact

This enables full trace visualization for outgoing calls from parameters, connection strings, and GitHub models resources to uninstrumented peers. The trace UI experience now matches the behavior for all supported resource types, providing complete visibility over dependency chains regardless of resource instrumentation status.

Fixes #10338.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…n strings, and GitHub models

Co-authored-by: davidfowl <[email protected]>
@Copilot Copilot AI changed the title [WIP] Support uninstrumented peer visualization for parameters, connection strings, and GitHub models resources Support uninstrumented peer visualization for parameters, connection strings, and GitHub models resources Jul 11, 2025
@Copilot Copilot AI requested a review from davidfowl July 11, 2025 18:44
Copilot finished work on behalf of davidfowl July 11, 2025 18:44
@Copilot Copilot AI requested a review from davidfowl July 11, 2025 19:07
Copilot finished work on behalf of davidfowl July 11, 2025 19:07
@davidfowl davidfowl marked this pull request as ready for review July 11, 2025 19:22
@davidfowl davidfowl added this to the 9.4 milestone Jul 11, 2025
@Copilot Copilot AI requested a review from davidfowl July 11, 2025 20:31
Copilot finished work on behalf of davidfowl July 11, 2025 20:31
Copilot finished work on behalf of davidfowl July 11, 2025 21:09
@davidfowl
Copy link
Member

@copilot ConnectionStringParserTests has some failing tests

Copilot finished work on behalf of davidfowl July 12, 2025 23:43
@Copilot Copilot AI requested a review from JamesNK July 14, 2025 04:17
Copilot finished work on behalf of JamesNK July 14, 2025 04:17
@davidfowl
Copy link
Member

@copilot Cache the resource addresses on the type. Recompute them when resource changes are detected.

…omputation on each peer resolution

Co-authored-by: davidfowl <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jul 14, 2025

@copilot Cache the resource addresses on the type. Recompute them when resource changes are detected.

Implemented caching of resource addresses on the ResourceOutgoingPeerResolver type. The cache is automatically updated when peer-relevant changes are detected, eliminating the performance overhead of repeated address extraction on each peer resolution. Commit d0c1afb.

@Copilot Copilot AI requested a review from davidfowl July 14, 2025 05:18
Copilot finished work on behalf of davidfowl July 14, 2025 05:18
@davidfowl
Copy link
Member

We want the cache on the ResourceViewModel

Copy link
Contributor Author

Copilot AI commented Jul 14, 2025

We want the cache on the ResourceViewModel

Moved the cache to ResourceViewModel as requested. Each ResourceViewModel now has a CachedAddresses property that lazily computes and caches its own addresses, eliminating the global cache and related change detection logic from ResourceOutgoingPeerResolver. Commit b7c2862.

Copilot finished work on behalf of davidfowl July 14, 2025 05:36
@davidfowl davidfowl merged commit 6538c37 into main Jul 14, 2025
276 checks passed
@davidfowl davidfowl deleted the copilot/fix-10338 branch July 14, 2025 13:52
@davidfowl
Copy link
Member

/backport to release/9.4

Copy link
Contributor

Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16268754388

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support uninstrumented peer visualization for parameters, connection strings, and GitHub models resources
3 participants