File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
src/Aspire.Dashboard/Otlp/Model
tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ public void AddSpan(OtlpSpan span)
7070 if ( HasCircularReference ( span ) )
7171 {
7272 Spans . Remove ( span ) ;
73- throw new InvalidOperationException ( $ "Circular loop detected for span '{ span . SpanId } '.") ;
73+ throw new InvalidOperationException ( $ "Circular loop detected for span '{ span . SpanId } ' with parent ' { span . ParentSpanId } ' .") ;
7474 }
7575
7676 if ( string . IsNullOrEmpty ( span . ParentSpanId ) )
Original file line number Diff line number Diff line change 88using Aspire . Dashboard . Otlp . Storage ;
99using Google . Protobuf ;
1010using Google . Protobuf . Collections ;
11+ using Microsoft . Extensions . Logging ;
12+ using Microsoft . Extensions . Logging . Testing ;
1113using OpenTelemetry . Proto . Common . V1 ;
1214using OpenTelemetry . Proto . Trace . V1 ;
1315using Xunit ;
@@ -94,7 +96,10 @@ public void AddTraces()
9496 public void AddTraces_SelfParent_Reject ( )
9597 {
9698 // Arrange
97- var repository = CreateRepository ( ) ;
99+ var testSink = new TestSink ( ) ;
100+ var factory = LoggerFactory . Create ( b => b . AddProvider ( new TestLoggerProvider ( testSink ) ) ) ;
101+
102+ var repository = CreateRepository ( loggerFactory : factory ) ;
98103
99104 // Act
100105 var addContext = new AddContext ( ) ;
@@ -137,6 +142,10 @@ public void AddTraces_SelfParent_Reject()
137142 Filters = [ ]
138143 } ) ;
139144 Assert . Empty ( traces . PagedResult . Items ) ;
145+
146+ var write = Assert . Single ( testSink . Writes ) ;
147+ Assert . Equal ( "Error adding span." , write . Message ) ;
148+ Assert . Equal ( "Circular loop detected for span '312d31' with parent '312d31'." , write . Exception ! . Message ) ;
140149 }
141150
142151 [ Fact ]
You can’t perform that action at this time.
0 commit comments