4 instantiations of OtlpSpan
Aspire.Dashboard (2)
Otlp\Model\OtlpSpan.cs (1)
82return new OtlpSpan(item.Source, trace, item.Scope)
Otlp\Storage\TelemetryRepository.cs (1)
1236var newSpan = new OtlpSpan(resourceView, trace, scope)
Aspire.Dashboard.Components.Tests (1)
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
310return new OtlpSpan(resource.GetView([]), trace, scope)
Aspire.Dashboard.Tests (1)
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
310return new OtlpSpan(resource.GetView([]), trace, scope)
130 references to OtlpSpan
Aspire.Dashboard (106)
Components\Controls\Chart\ChartBase.cs (6)
63private Dictionary<SpanKey, OtlpSpan> _currentCache = new Dictionary<SpanKey, OtlpSpan>(); 64private Dictionary<SpanKey, OtlpSpan> _newCache = new Dictionary<SpanKey, OtlpSpan>(); 315if (!_currentCache.TryGetValue(key, out var span)) 514_newCache = new Dictionary<SpanKey, OtlpSpan>();
Components\Controls\Chart\ChartExemplar.cs (1)
16public required OtlpSpan? Span { get; init; }
Components\Controls\PropertyValues\SpanKindValue.razor.cs (1)
22public required OtlpSpan Span { get; set; }
Components\Controls\PropertyValues\SpanStatusValue.razor.cs (1)
18public required OtlpSpan Span { get; set; }
Components\Dialogs\GenAIVisualizerDialog.razor.cs (8)
26private List<OtlpSpan> _contextSpans = default!; 68var span = _contextSpans.Find(s => s.SpanId == Content.Span.SpanId)!; 119if (TryGetContextSpanByIndex(_currentSpanContextIndex - 1, out var span)) 127if (TryGetContextSpanByIndex(_currentSpanContextIndex + 1, out var span)) 133private bool TryGetContextSpanByIndex(int index, [NotNullWhen(true)] out OtlpSpan? span) 139private bool TryUpdateViewedGenAISpan(OtlpSpan newSpan) 173IStringLocalizer<Resources.Dialogs> dialogsLoc, OtlpSpan span, long? selectedLogEntryId, 174TelemetryRepository telemetryRepository, List<OtlpResource> resources, Func<List<OtlpSpan>> getContextGenAISpans)
Components\Pages\StructuredLogs.razor.cs (1)
494var span = TelemetryRepository.GetSpan(logEntry.TraceId, logEntry.SpanId)!;
Components\Pages\TraceDetail.razor.cs (3)
213var headerSpan = _trace.RootOrFirstSpan; 291foreach (var span in _trace.Spans) 527var genAISpans = new List<OtlpSpan>();
Model\GenAI\GenAIItemViewModel.cs (1)
27public required OtlpSpan Parent { get; init; }
Model\GenAI\GenAIVisualizerDialogViewModel.cs (4)
19public required OtlpSpan Span { get; init; } 23public required Func<List<OtlpSpan>> GetContextGenAISpans { get; init; } 48Func<List<OtlpSpan>> getContextGenAISpans) 394private static List<OtlpLogEntry> GetSpanLogEntries(TelemetryRepository telemetryRepository, OtlpSpan span)
Model\Otlp\SpanWaterfallViewModel.cs (5)
14public required OtlpSpan Span { get; init; } 123public static string GetTitle(OtlpSpan span, List<OtlpResource> allResources) 134TraceHelpers.VisitSpans(trace, (OtlpSpan span, SpanWaterfallViewModelState s) => 147static SpanWaterfallViewModel CreateViewModel(OtlpSpan span, int depth, bool hidden, TraceDetailState state, List<OtlpLogEntry>? spanLogs, ref int currentSpanLogIndex) 216private static string? ResolveUninstrumentedPeerName(OtlpSpan span, IOutgoingPeerResolver[] outgoingPeerResolvers)
Model\Otlp\TelemetryFilter.cs (3)
20public abstract bool Apply(OtlpSpan span); 143public override bool Apply(OtlpSpan span) 145var fieldValue = OtlpSpan.GetFieldValue(span, Field);
Model\SpanDetailsViewModel.cs (3)
15public required OtlpSpan Span { get; init; } 22public static SpanDetailsViewModel Create(OtlpSpan span, TelemetryRepository telemetryRepository, List<OtlpResource> resources) 55var linkSpan = trace?.Spans.FirstOrDefault(s => s.SpanId == spanId);
Model\SpanLinkViewModel.cs (1)
13public required OtlpSpan? Span { get; init; }
Model\SpanType.cs (2)
89public override bool Apply(OtlpSpan span) 122public override bool Apply(OtlpSpan span)
Model\TraceHelpers.cs (11)
15public static void VisitSpans<TState>(OtlpTrace trace, Func<OtlpSpan, TState, TState> spanAction, TState state) 21var orderByFunc = static (OtlpSpan s) => s.StartTime; 23foreach (var unrootedSpan in trace.Spans.Where(s => s.GetParentSpan() == null).OrderBy(orderByFunc)) 30static void Visit(OtlpSpanCollection allSpans, OtlpSpan span, Func<OtlpSpan, TState, TState> spanAction, TState state, Func<OtlpSpan, DateTime> orderByFunc) 32foreach (var childSpan in OtlpSpan.GetChildSpans(span, allSpans).OrderBy(orderByFunc)) 52VisitSpans(trace, (OtlpSpan span, OrderedResourcesState state) => 72private static void ProcessSpanResource(OtlpSpan span, OtlpResource resource, Dictionary<OtlpResource, OrderedResource> resourceFirstTimes, DateTime currentMinDate) 111public static Icon? TryGetSpanIcon(OtlpSpan span, IconVariant iconVariant)
Model\TraceLinkHelpers.cs (1)
20Func<string, string, OtlpSpan?> getSpan,
Otlp\Model\OtlpHelpers.cs (5)
361var address = GetValue(values, OtlpSpan.PeerServiceAttributeKey); 368if (GetValue(values, OtlpSpan.ServerAddressAttributeKey) is { } server) 370if (GetValue(values, OtlpSpan.ServerPortAttributeKey) is { } serverPort) 378if (GetValue(values, OtlpSpan.NetPeerNameAttributeKey) is { } peer) 380if (GetValue(values, OtlpSpan.NetPeerPortAttributeKey) is { } peerPort)
Otlp\Model\OtlpSpan.cs (9)
47public IEnumerable<OtlpSpan> GetChildSpans() => GetChildSpans(this, Trace.Spans); 48public static IEnumerable<OtlpSpan> GetChildSpans(OtlpSpan parentSpan, OtlpSpanCollection spans) => spans.Where(s => s.ParentSpanId == parentSpan.SpanId); 58public OtlpSpan? GetParentSpan() 65if (Trace.Spans.TryGetValue(ParentSpanId, out var span)) 80public static OtlpSpan Clone(OtlpSpan item, OtlpTrace trace) 137static string BuildDisplaySummary(OtlpSpan span) 192public static FieldValues GetFieldValue(OtlpSpan span, string field)
Otlp\Model\OtlpSpanCollection.cs (4)
8public sealed class OtlpSpanCollection : KeyedCollection<string, OtlpSpan> 17protected override string GetKeyForItem(OtlpSpan item) 22public new List<OtlpSpan>.Enumerator GetEnumerator() 25return ((List<OtlpSpan>)this.Items).GetEnumerator();
Otlp\Model\OtlpSpanEvent.cs (1)
14public class OtlpSpanEvent(OtlpSpan span) : IPropertyGridItem
Otlp\Model\OtlpTrace.cs (19)
11private OtlpSpan? _rootSpan; 17public OtlpSpan FirstSpan => Spans[0]; // There should always be at least one span in a trace. 19public OtlpSpan? RootSpan => _rootSpan; 20public OtlpSpan RootOrFirstSpan => RootSpan ?? FirstSpan; 27foreach (var span in Spans) 41public int CalculateDepth(OtlpSpan span) 44var currentSpan = span; 55public void AddSpan(OtlpSpan span, bool skipLastUpdatedDate = false) 87foreach (var existingSpan in Spans) 110static string BuildFullName(OtlpSpan existingSpan) 116private static bool HasCircularReference(OtlpSpan span) 126var currentSpan = span; 147var span = Spans[i]; 168foreach (var item in trace.Spans) 170newTrace.AddSpan(OtlpSpan.Clone(item, newTrace), skipLastUpdatedDate: true); 181public void SetSpanUninstrumentedPeer(OtlpSpan span, OtlpResource? resource) 192private sealed class SpanStartDateComparer : IComparer<OtlpSpan> 196public int Compare(OtlpSpan? x, OtlpSpan? y)
Otlp\Storage\TelemetryRepository.cs (16)
89foreach (var span in trace.Spans) 532foreach (var span in t.Spans) 592foreach (var span in t.Spans) 715foreach (var span in trace.Spans) 717var values = OtlpSpan.GetFieldValue(span, attributeName); 827private OtlpSpan? GetSpanAndCloneUnsynchronized(string traceId, string spanId) 835foreach (var span in trace.Spans) 847public OtlpSpan? GetSpan(string traceId, string spanId) 977var newSpan = CreateSpan(resourceView, span, trace, scope, _otlpContext); 995var linkedSpan = GetSpanAndCloneUnsynchronized(link.TraceId, link.SpanId); 1105public OtlpResource? GetPeerResource(OtlpSpan span) 1120foreach (var span in trace.Spans) 1146private static ResourceViewModel? ResolveUninstrumentedPeerResource(OtlpSpan span, IEnumerable<IOutgoingPeerResolver> outgoingPeerResolvers) 1186foreach (var span in trace.Spans) 1212private static OtlpSpan CreateSpan(OtlpResourceView resourceView, Span span, OtlpTrace trace, OtlpScope scope, OtlpContext context) 1236var newSpan = new OtlpSpan(resourceView, trace, scope)
Aspire.Dashboard.Components.Tests (1)
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
306public static OtlpSpan CreateOtlpSpan(OtlpResource resource, OtlpTrace trace, OtlpScope scope, string spanId, string? parentSpanId, DateTime startDate,
Aspire.Dashboard.Tests (23)
Model\GenAIVisualizerDialogViewModelTests.cs (6)
49var span = repository.GetSpan(GetHexId("1"), GetHexId("1-1"))!; 100var span = repository.GetSpan(GetHexId("1"), GetHexId("1-1"))!; 184var span = repository.GetSpan(GetHexId("1"), GetHexId("1-1"))!; 271var span = repository.GetSpan(GetHexId("1"), GetHexId("1-1"))!; 375var span = repository.GetSpan(GetHexId("1"), GetHexId("1-1"))!; 498var span = repository.GetSpan(GetHexId("1"), GetHexId("1-1"))!;
Model\ResourceMenuItemsTests.cs (2)
71TelemetryTestHelpers.CreateSpan(traceId: "1", spanId: "1-1", startTime: s_testTime.AddMinutes(1), endTime: s_testTime.AddMinutes(10), attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-1")], kind: Span.Types.SpanKind.Client), 72TelemetryTestHelpers.CreateSpan(traceId: "1", spanId: "1-2", startTime: s_testTime.AddMinutes(5), endTime: s_testTime.AddMinutes(10), parentSpanId: "1-1", attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-2")], kind: Span.Types.SpanKind.Client)
Model\SpanWaterfallViewModelTests.cs (6)
128var span = TelemetryTestHelpers.CreateOtlpSpan( 182var span = TelemetryTestHelpers.CreateOtlpSpan( 226var parentSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "parent", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)); 227var childSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "child", parentSpanId: "parent", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc)); 248var parentSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "parent", parentSpanId: null, startDate: new DateTime(2001, 1, 1, 1, 1, 2, DateTimeKind.Utc)); 249var childSpan = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "child", parentSpanId: "parent", startDate: new DateTime(2001, 1, 1, 1, 1, 3, DateTimeKind.Utc));
TelemetryRepositoryTests\OtlpSpanTests.cs (1)
25var span = TelemetryTestHelpers.CreateOtlpSpan(app1, trace, scope, spanId: "abc", parentSpanId: null, startDate: s_testTime,
TelemetryRepositoryTests\TraceTests.cs (7)
1257Spans = { CreateSpan(traceId: "1", spanId: "1-1", startTime: s_testTime.AddMinutes(1), endTime: s_testTime.AddMinutes(10), attributes: [KeyValuePair.Create("key1", "value1"), KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-1")], kind: Span.Types.SpanKind.Client) } 1952CreateSpan(traceId: "1", spanId: "1-1", startTime: s_testTime.AddMinutes(1), endTime: s_testTime.AddMinutes(10), attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-1")], kind: Span.Types.SpanKind.Client), 1953CreateSpan(traceId: "1", spanId: "1-2", startTime: s_testTime.AddMinutes(5), endTime: s_testTime.AddMinutes(10), parentSpanId: "1-1", attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-2")], kind: Span.Types.SpanKind.Client) 2039CreateSpan(traceId: "1", spanId: "1-1", startTime: s_testTime.AddMinutes(1), endTime: s_testTime.AddMinutes(10), attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-1")], kind: Span.Types.SpanKind.Client), 2040CreateSpan(traceId: "1", spanId: "1-2", startTime: s_testTime.AddMinutes(5), endTime: s_testTime.AddMinutes(10), parentSpanId: "1-1", attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-2")], kind: Span.Types.SpanKind.Client) 2145CreateSpan(traceId: "1", spanId: "1-1", startTime: s_testTime.AddMinutes(1), endTime: s_testTime.AddMinutes(10), attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-1")], kind: Span.Types.SpanKind.Client), 2146CreateSpan(traceId: "1", spanId: "1-2", startTime: s_testTime.AddMinutes(5), endTime: s_testTime.AddMinutes(10), parentSpanId: "1-1", attributes: [KeyValuePair.Create(OtlpSpan.PeerServiceAttributeKey, "value-2")], kind: Span.Types.SpanKind.Client)
tests\Shared\Telemetry\TelemetryTestHelpers.cs (1)
306public static OtlpSpan CreateOtlpSpan(OtlpResource resource, OtlpTrace trace, OtlpScope scope, string spanId, string? parentSpanId, DateTime startDate,