Skip to content

Commit fb95dcd

Browse files
committed
Improve OTLP tunnel name
1 parent 925675d commit fb95dcd

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/Aspire.Hosting.Maui/MauiOtlpExtensions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ private static OtlpDevTunnelConfigurationAnnotation CreateOtlpDevTunnelInfrastru
8888
var (otlpScheme, otlpPort) = OtlpEndpointResolver.ResolveSchemeAndPort(configuration);
8989

9090
// Create names for the tunnel infrastructure
91-
// The dev tunnel port resource will be named: {tunnelName}-{stubName}-{endpointName}
92-
// Stub must be unique across all MAUI projects, so include parent resource name
93-
var tunnelName = $"{parentBuilder.Resource.Name}-tunnel";
94-
var stubName = $"{parentBuilder.Resource.Name}-otlp";
91+
// Use a short random suffix to ensure uniqueness (similar to DCP naming strategy)
92+
// The dev tunnel port resource name will be: {parent resource name}-{random}-otlp
93+
var randomSuffix = Guid.NewGuid().ToString("N")[..8];
94+
var tunnelName = parentBuilder.Resource.Name;
95+
var stubName = $"t{randomSuffix}"; // Prefix with 't' to ensure valid resource name
9596

9697
// Create OtlpLoopbackResource - a synthetic IResourceWithEndpoints for service discovery
9798
var stubResource = new OtlpLoopbackResource(stubName, otlpPort, otlpScheme);

0 commit comments

Comments
 (0)