This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
src/System.Diagnostics.DiagnosticSource Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,9 @@ public class Keywords
164
164
"httpContext.Request.Path;" +
165
165
"httpContext.Request.QueryString" +
166
166
"\n " +
167
- "Microsoft.AspNetCore/Microsoft.AspNetCore.Hosting.EndRequest@Activity1Stop:-" ;
167
+ "Microsoft.AspNetCore/Microsoft.AspNetCore.Hosting.EndRequest@Activity1Stop:-" +
168
+ "httpContext.TraceIdentifier;" +
169
+ "httpContext.Response.StatusCode" ;
168
170
169
171
// Setting EntityFrameworkCoreCommands is like having this in the FilterAndPayloadSpecs string
170
172
// It turns on basic SQL commands.
Original file line number Diff line number Diff line change @@ -586,11 +586,25 @@ public void TestShortcutKeywords()
586
586
eventSourceListener . ResetEventCountAndLastEvent ( ) ;
587
587
588
588
// Stop the ASP.NET reqeust.
589
- aspNetCoreSource . Write ( "Microsoft.AspNetCore.Hosting.EndRequest" , null ) ;
589
+ aspNetCoreSource . Write ( "Microsoft.AspNetCore.Hosting.EndRequest" ,
590
+ new
591
+ {
592
+ httpContext = new
593
+ {
594
+ Response = new
595
+ {
596
+ StatusCode = "200"
597
+ } ,
598
+ TraceIdentifier = "MyTraceId"
599
+ }
600
+ } ) ;
590
601
Assert . Equal ( 1 , eventSourceListener . EventCount ) ; // Exactly one more event has been emitted.
591
602
Assert . Equal ( "Activity1Stop" , eventSourceListener . LastEvent . EventSourceEventName ) ;
592
603
Assert . Equal ( "Microsoft.AspNetCore" , eventSourceListener . LastEvent . SourceName ) ;
593
604
Assert . Equal ( "Microsoft.AspNetCore.Hosting.EndRequest" , eventSourceListener . LastEvent . EventName ) ;
605
+ Assert . True ( 2 <= eventSourceListener . LastEvent . Arguments . Count ) ;
606
+ Assert . Equal ( "MyTraceId" , eventSourceListener . LastEvent . Arguments [ "TraceIdentifier" ] ) ;
607
+ Assert . Equal ( "200" , eventSourceListener . LastEvent . Arguments [ "StatusCode" ] ) ;
594
608
eventSourceListener . ResetEventCountAndLastEvent ( ) ;
595
609
}
596
610
}
You can’t perform that action at this time.
0 commit comments