1 implementation of IOtlpResource
aspire (1)
src\Shared\Otlp\IOtlpResource.cs (1)
28public sealed record SimpleOtlpResource(string ResourceName, string? InstanceId) : IOtlpResource;
50 references to IOtlpResource
aspire (43)
Commands\ExportCommand.cs (2)
291IReadOnlyList<IOtlpResource> allOtlpResources, 322IReadOnlyList<IOtlpResource> allOtlpResources,
Commands\TelemetryCommandHelpers.cs (5)
624/// Converts resource information to a list of <see cref="IOtlpResource"/> values. 626public static IReadOnlyList<IOtlpResource> ToOtlpResources(IList<ResourceInfoJson> resources) 628var result = new IOtlpResource[resources.Count]; 640public static void ResolveResourceColors(ResourceColorMap colorMap, IReadOnlyList<IOtlpResource> allResources) 649public static string ResolveResourceName(OtlpResourceJson? resource, IReadOnlyList<IOtlpResource> allResources)
Commands\TelemetryLogsCommand.cs (7)
166private async Task<int> GetLogsSnapshotAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken) 177Func<IOtlpResource, string> getResourceName = s => OtlpHelpers.GetResourceName(s, allResources); 188private async Task<int> StreamLogsAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken) 202Func<IOtlpResource, string> getResourceName = s => OtlpHelpers.GetResourceName(s, allResources); 214private void DisplayLogsSnapshot(string json, IReadOnlyList<IOtlpResource> allResources) 228private void DisplayLogsStreamLine(string json, IReadOnlyList<IOtlpResource> allResources) 234private void DisplayResourceLogs(IEnumerable<OtlpResourceLogsJson> resourceLogs, IReadOnlyList<IOtlpResource> allResources)
Commands\TelemetrySpansCommand.cs (7)
158private async Task<int> GetSpansSnapshotAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken) 169Func<IOtlpResource, string> getResourceName = s => OtlpHelpers.GetResourceName(s, allResources); 180private async Task<int> StreamSpansAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken) 194Func<IOtlpResource, string> getResourceName = s => OtlpHelpers.GetResourceName(s, allResources); 206private void DisplaySpansSnapshot(string json, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl) 220private void DisplaySpansStreamLine(string json, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl) 226private void DisplayResourceSpans(IEnumerable<OtlpResourceSpansJson> resourceSpans, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl)
Commands\TelemetryTracesCommand.cs (4)
162Func<IOtlpResource, string> getResourceName = s => OtlpHelpers.GetResourceName(s, allOtlpResources); 215Func<IOtlpResource, string> getResourceName = s => OtlpHelpers.GetResourceName(s, allOtlpResources); 226private void DisplayTracesTable(string json, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl) 300private void DisplayTraceDetails(string json, string traceId, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl)
src\Shared\ConsoleLogs\SharedAIHelpers.cs (13)
60Func<IOtlpResource, string> getResourceName, 89Func<IOtlpResource, string> getResourceName, 109Func<IOtlpResource, string> getResourceName, 138Func<IOtlpResource, string> getResourceName, 155Func<IOtlpResource, string> getResourceName, 169Func<IOtlpResource, string> getResourceName, 183Func<IOtlpResource, string> getResourceName, 197Func<IOtlpResource, string>? getResourceName = null, 211Func<IOtlpResource, string> getResourceName, 380Func<IOtlpResource, string> getResourceName, 712Func<IOtlpResource, string> getResourceName, 889internal sealed record OtlpLogEntryDto(OtlpLogRecordJson LogRecord, IOtlpResource Resource, string? ScopeName); 904internal sealed record OtlpSpanDto(OtlpSpanJson Span, IOtlpResource Resource, string? ScopeName);
src\Shared\Otlp\IOtlpResource.cs (1)
24/// Simple implementation of <see cref="IOtlpResource"/> for cases where only the name and instance ID are needed.
src\Shared\Otlp\OtlpHelpers.cs (4)
89public static string GetResourceName(IOtlpResource resource, IReadOnlyList<IOtlpResource> allResources) 92foreach (var item in allResources) 135where T : IOtlpResource
Aspire.Cli.Tests (7)
Commands\TelemetryCommandTests.cs (7)
241IOtlpResource[] allResources, 255yield return [null, Array.Empty<IOtlpResource>(), "unknown"]; 257yield return [new OtlpResourceJson { Attributes = null }, new IOtlpResource[] { new SimpleOtlpResource("unknown", null) }, "unknown"]; 259yield return [MakeResource("frontend", "abc123"), new IOtlpResource[] { new SimpleOtlpResource("frontend", "abc123") }, "frontend"]; 261yield return [MakeResource("apiservice", null), new IOtlpResource[] { new SimpleOtlpResource("apiservice", null) }, "apiservice"]; 263yield return [MakeResource("frontend", "abc123"), new IOtlpResource[] { new SimpleOtlpResource("frontend", "abc123"), new SimpleOtlpResource("frontend", "xyz789") }, "frontend-abc123"]; 265yield return [MakeResource("worker", guidStr), new IOtlpResource[] { new SimpleOtlpResource("worker", guidStr), new SimpleOtlpResource("worker", Guid.NewGuid().ToString()) }, $"worker-{guid.ToString("N")[^8..]}"];