File tree Expand file tree Collapse file tree 3 files changed +6
-47
lines changed
src/Aspire.Dashboard/Otlp/Model Expand file tree Collapse file tree 3 files changed +6
-47
lines changed Original file line number Diff line number Diff line change 1- // Licensed to the .NET Foundation under one or more agreements.
1+ // Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
44using System . Collections . ObjectModel ;
55
66namespace Aspire . Dashboard . Otlp . Model ;
77
8- public sealed class SpanCollection : KeyedCollection < string , OtlpSpan >
8+ public sealed class OtlpSpanCollection : KeyedCollection < string , OtlpSpan >
99{
1010 // Chosen to balance memory usage overhead of dictionary vs work to find spans by ID.
1111 private const int DictionaryCreationThreshold = 128 ;
1212
13- public SpanCollection ( ) : base ( StringComparers . OtlpSpanId , DictionaryCreationThreshold )
13+ public OtlpSpanCollection ( ) : base ( StringComparers . OtlpSpanId , DictionaryCreationThreshold )
1414 {
1515 }
1616
@@ -21,6 +21,7 @@ protected override string GetKeyForItem(OtlpSpan item)
2121
2222 public new List < OtlpSpan > . Enumerator GetEnumerator ( )
2323 {
24+ // Avoid allocating an enumerator when iterated with foreach.
2425 return ( ( List < OtlpSpan > ) this . Items ) . GetEnumerator ( ) ;
2526 }
2627}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public TimeSpan Duration
3434 }
3535 }
3636
37- public SpanCollection Spans { get ; } = new SpanCollection ( ) ;
37+ public OtlpSpanCollection Spans { get ; } = new OtlpSpanCollection ( ) ;
3838
3939 public int CalculateDepth ( OtlpSpan span )
4040 {
@@ -115,7 +115,7 @@ private static bool HasCircularReference(OtlpSpan span)
115115 }
116116
117117 // Walk up span ancestors to check there is no loop.
118- var stack = new SpanCollection { span } ;
118+ var stack = new OtlpSpanCollection { span } ;
119119 var currentSpan = span ;
120120 while ( currentSpan . GetParentSpan ( ) is { } parentSpan )
121121 {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments