Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove duplicated TryResolvePeerNameCore method and use TryResolvePee…
…rCore instead

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
  • Loading branch information
Copilot and davidfowl committed Jul 15, 2025
commit 7de900feffc8e234144a715fae3520069d1add6e
29 changes: 2 additions & 27 deletions src/Aspire.Dashboard/Model/ResourceOutgoingPeerResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,35 +144,10 @@ private static bool ArePropertyValuesEquivalent(ResourceViewModel resource1, Res

public bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResource)
{
var address = OtlpHelpers.GetPeerAddress(attributes);
if (address != null)
{
// Apply transformers to the peer address cumulatively
var transformedAddress = address;

// First check exact match
if (TryMatchAgainstResources(transformedAddress, _resourceByName, out name, out matchedResource))
{
return true;
}

// Then apply each transformer cumulatively and check
foreach (var transformer in s_addressTransformers)
{
transformedAddress = transformer(transformedAddress);
if (TryMatchAgainstResources(transformedAddress, _resourceByName, out name, out matchedResource))
{
return true;
}
}
}

name = null;
matchedResource = null;
return false;
return TryResolvePeerCore(_resourceByName, attributes, out name, out matchedResource);
}

internal static bool TryResolvePeerNameCore(IDictionary<string, ResourceViewModel> resources, KeyValuePair<string, string>[] attributes, [NotNullWhen(true)] out string? name, [NotNullWhen(true)] out ResourceViewModel? resourceMatch)
internal static bool TryResolvePeerCore(IDictionary<string, ResourceViewModel> resources, KeyValuePair<string, string>[] attributes, [NotNullWhen(true)] out string? name, [NotNullWhen(true)] out ResourceViewModel? resourceMatch)
{
var address = OtlpHelpers.GetPeerAddress(attributes);
if (address != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void NameAndDisplayNameDifferent_MultipleInstances_ReturnName()

private static bool TryResolvePeerName(IDictionary<string, ResourceViewModel> resources, KeyValuePair<string, string>[] attributes, out string? peerName)
{
return ResourceOutgoingPeerResolver.TryResolvePeerNameCore(resources, attributes, out peerName, out _);
return ResourceOutgoingPeerResolver.TryResolvePeerCore(resources, attributes, out peerName, out _);
}

[Fact]
Expand Down
Loading